This repository has been archived by the owner on Aug 23, 2024. It is now read-only.
Fixes organization link in prod environment #1023
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Main | |
on: | |
push: | |
paths-ignore: | |
- '.github/**' | |
pull_request: | |
paths-ignore: | |
- '.github/**' | |
jobs: | |
node-tests-and-build: | |
runs-on: self-hosted | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- name: Install dependencies | |
run: yarn | |
- name: Lint | |
run: yarn lint | |
- name: Run tests | |
run: yarn test | |
- name: Build | |
run: yarn build | |
docker-release: | |
runs-on: self-hosted | |
needs: | |
- node-tests-and-build | |
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/stg' || startsWith(github.ref, 'refs/heads/release') || github.ref == 'refs/heads/wip/mockup' | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.CR_PAT }} | |
- name: Get branch name, git commit hash and current time in secs | |
id: vars | |
shell: bash | |
run: | | |
echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr '/' '-' )" >> $GITHUB_OUTPUT | |
echo "GIT_HASH_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
echo "DATE_IN_SECS=$(date +%s)" >> $GITHUB_OUTPUT | |
- name: Push to ghcr.io (main, static) | |
uses: docker/build-push-action@v4 | |
if: github.ref == 'refs/heads/master' | |
with: | |
context: . | |
file: ./Dockerfile.static | |
platforms: linux/amd64 | |
push: true | |
build-args: | | |
COMMIT_SHA=${{ steps.vars.outputs.GIT_HASH_SHORT }} | |
VOCDONI_ENVIRONMENT=dev | |
ETH_NETWORK_ID=goerli | |
tags: | | |
ghcr.io/vocdoni/${{ github.event.repository.name }}:${{ steps.vars.outputs.BRANCH_NAME }}-static | |
ghcr.io/vocdoni/${{ github.event.repository.name }}:commit-${{ steps.vars.outputs.GIT_HASH_SHORT }} | |
ghcr.io/vocdoni/${{ github.event.repository.name }}:${{ steps.vars.outputs.BRANCH_NAME }}-static-${{ steps.vars.outputs.DATE_IN_SECS }} | |
- name: Push to ghcr.io (stg, static) | |
uses: docker/build-push-action@v4 | |
if: github.ref == 'refs/heads/stg' | |
with: | |
context: . | |
file: ./Dockerfile.static | |
platforms: linux/amd64 | |
push: true | |
build-args: | | |
COMMIT_SHA=${{ steps.vars.outputs.GIT_HASH_SHORT }} | |
VOCDONI_ENVIRONMENT=stg | |
ETH_NETWORK_ID=goerli | |
tags: | | |
ghcr.io/vocdoni/${{ github.event.repository.name }}:${{ steps.vars.outputs.BRANCH_NAME }} | |
ghcr.io/vocdoni/${{ github.event.repository.name }}:commit-${{ steps.vars.outputs.GIT_HASH_SHORT }} | |
ghcr.io/vocdoni/${{ github.event.repository.name }}:${{ steps.vars.outputs.BRANCH_NAME }}-static-${{ steps.vars.outputs.DATE_IN_SECS }} | |
- name: Push to ghcr.io (prod, static) | |
uses: docker/build-push-action@v4 | |
if: startsWith(github.ref, 'refs/heads/release') | |
with: | |
context: . | |
file: ./Dockerfile.static | |
platforms: linux/amd64 | |
push: true | |
build-args: | | |
COMMIT_SHA=${{ steps.vars.outputs.GIT_HASH_SHORT }} | |
VOCDONI_ENVIRONMENT=prod | |
ETH_NETWORK_ID=xdai | |
tags: | | |
ghcr.io/vocdoni/${{ github.event.repository.name }}:${{ steps.vars.outputs.BRANCH_NAME }} | |
ghcr.io/vocdoni/${{ github.event.repository.name }}:commit-${{ steps.vars.outputs.GIT_HASH_SHORT }} | |
ghcr.io/vocdoni/${{ github.event.repository.name }}:${{ steps.vars.outputs.BRANCH_NAME }}-static-${{ steps.vars.outputs.DATE_IN_SECS }} |