Deprecated banner v2 #2387
Workflow file for this run
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, pull_request] | |
jobs: | |
node-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm install | |
docker-release: | |
runs-on: ubuntu-latest | |
needs: | |
- node-tests | |
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/stage' || github.ref == 'refs/heads/fcb' || startsWith(github.ref, 'refs/heads/release') | |
steps: | |
- name: Clean residue in workspace from previous self-hosted builds (remove it if runs on gh) | |
uses: AutoModality/[email protected] | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- 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 short branch name and commit sha | |
id: var | |
shell: bash | |
# Grab the short branch name, convert slashes to dashes | |
run: | | |
echo "branch_name=$(echo ${GITHUB_REF#refs/heads/} | tr '/' '-' )" >> $GITHUB_OUTPUT | |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Push to Docker Hub and ghcr.io (main) | |
uses: docker/build-push-action@v3 | |
if: github.ref == 'refs/heads/main' | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64 | |
push: true | |
build-args: | | |
COMMIT_SHA=${{ steps.var.outputs.sha_short }} | |
DISCOVERY_POOL_SIZE=1 | |
tags: | | |
vocdoni/${{ github.event.repository.name }}:latest, vocdoni/${{ github.event.repository.name }}:${{ steps.var.outputs.branch_name }}, | |
ghcr.io/vocdoni/${{ github.event.repository.name }}:latest, ghcr.io/vocdoni/${{ github.event.repository.name }}:${{ steps.var.outputs.branch_name }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Push to Docker Hub and ghcr.io (main static, development) | |
uses: docker/build-push-action@v3 | |
if: github.ref == 'refs/heads/main' | |
with: | |
context: . | |
file: ./Dockerfile.static | |
platforms: linux/amd64 | |
push: true | |
build-args: | | |
COMMIT_SHA=${{ steps.var.outputs.sha_short }} | |
DISCOVERY_POOL_SIZE=1 | |
tags: | | |
vocdoni/${{ github.event.repository.name }}:latest-static, vocdoni/${{ github.event.repository.name }}:${{ steps.var.outputs.branch_name }}-static, | |
ghcr.io/vocdoni/${{ github.event.repository.name }}:latest-static, ghcr.io/vocdoni/${{ github.event.repository.name }}:${{ steps.var.outputs.branch_name }}-static | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Push to Docker Hub and ghcr.io (stage) | |
uses: docker/build-push-action@v3 | |
if: github.ref == 'refs/heads/stage' | |
with: | |
context: . | |
file: ./Dockerfile.static | |
platforms: linux/amd64 | |
build-args: | | |
COMMIT_SHA=${{ steps.var.outputs.sha_short }} | |
VOCDONI_ENVIRONMENT=stg | |
ETH_NETWORK_ID=xdai | |
APP_TITLE="Vocdoni Staging" | |
BLOCK_TIME=12 | |
BOOTNODES_URL=https://raw.githubusercontent.com/vocdoni/bootnodes/main/content/gateways.stg.priv.json | |
BACKEND_URL=https://manager.stg.vocdoni.net/api/manager | |
BACKEND_PUB_KEY=03a0666d3ecd138b85713e240f0d9559b733c723765f6818e14f2f7e4e8c8bdb70 | |
COLOR_PICKER=1 | |
ADVANCED_CENSUs=1 | |
DISCOVERY_POOL_SIZE=1 | |
push: true | |
tags: | | |
vocdoni/${{ github.event.repository.name }}:${{ steps.var.outputs.branch_name }}, | |
ghcr.io/vocdoni/${{ github.event.repository.name }}:${{ steps.var.outputs.branch_name }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Push to Docker Hub and ghcr.io (release) | |
uses: docker/build-push-action@v3 | |
if: startsWith(github.ref, 'refs/heads/release') | |
with: | |
context: . | |
file: ./Dockerfile.static | |
platforms: linux/amd64 | |
build-args: | | |
COMMIT_SHA=${{ steps.var.outputs.sha_short }} | |
VOCDONI_ENVIRONMENT=prod | |
DEVELOPMENT=false | |
ETH_NETWORK_ID=xdai | |
BLOCK_TIME=12 | |
BOOTNODES_URL=https://raw.githubusercontent.com/vocdoni/bootnodes/main/content/gateways.priv.json | |
BACKEND_URL=https://backend.vocdoni.net/api/manager | |
BACKEND_PUB_KEY=03cd13285ea116b9093a47364b29ddb09eccf50aa2f0112b6084a0b10943964d4e | |
DISCOVERY_POOL_SIZE=1 | |
push: true | |
tags: | | |
vocdoni/${{ github.event.repository.name }}:${{ steps.var.outputs.branch_name }}, | |
ghcr.io/vocdoni/${{ github.event.repository.name }}:${{ steps.var.outputs.branch_name }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Push to Docker Hub and ghcr.io (fcb) | |
uses: docker/build-push-action@v3 | |
if: github.ref == 'refs/heads/fcb' | |
with: | |
context: . | |
file: ./Dockerfile.static | |
platforms: linux/amd64 | |
build-args: | | |
COMMIT_SHA=${{ steps.var.outputs.sha_short }} | |
VOCDONI_ENVIRONMENT=dev | |
DEVELOPMENT=false | |
ETH_NETWORK_ID=rinkeby | |
BLOCK_TIME=12 | |
BOOTNODES_URL=https://raw.githubusercontent.com/vocdoni/bootnodes/main/content/gateways.dev.json | |
BACKEND_URL=https://backend.vocdoni.net/api/manager | |
BACKEND_PUB_KEY=03cd13285ea116b9093a47364b29ddb09eccf50aa2f0112b6084a0b10943964d4e | |
DISCOVERY_POOL_SIZE=1 | |
push: true | |
tags: | | |
vocdoni/${{ github.event.repository.name }}:${{ steps.var.outputs.branch_name }}, | |
ghcr.io/vocdoni/${{ github.event.repository.name }}:${{ steps.var.outputs.branch_name }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Push to Docker Hub and ghcr.io (fcb) | |
uses: docker/build-push-action@v3 | |
if: github.ref == 'refs/heads/fcb' | |
with: | |
context: . | |
file: ./Dockerfile.static | |
platforms: linux/amd64 | |
build-args: | | |
COMMIT_SHA=${{ steps.var.outputs.sha_short }} | |
VOCDONI_ENVIRONMENT=dev | |
DEVELOPMENT=false | |
ETH_NETWORK_ID=rinkeby | |
BLOCK_TIME=12 | |
BOOTNODES_URL=https://bootnodes.vocdoni.net/gateways.dev.json | |
BACKEND_URL=https://backend.vocdoni.net/api/manager | |
BACKEND_PUB_KEY=03cd13285ea116b9093a47364b29ddb09eccf50aa2f0112b6084a0b10943964d4e | |
DISCOVERY_POOL_SIZE=1 | |
ANALYTICS_KEY=${{ secrets.ANALYTICS_KEY }} | |
ANALYTICS_URL=${{ secrets.ANALYTICS_URL }} | |
push: true | |
tags: | | |
vocdoni/${{ github.event.repository.name }}:${{ steps.var.outputs.branch_name }}, | |
ghcr.io/vocdoni/${{ github.event.repository.name }}:${{ steps.var.outputs.branch_name }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
gcs-release-production: | |
runs-on: self-hosted | |
environment: production | |
needs: | |
- node-tests | |
if: github.ref == 'refs/heads/release' | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
cache: 'npm' | |
- name: Get short commit sha | |
id: var | |
shell: bash | |
run: | | |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Install dependencies and build | |
run: | | |
npm install | |
npm run export | |
env: | |
COMMIT_SHA: ${{ steps.var.outputs.sha_short }} | |
DEVELOPMENT: 'false' | |
VOCDONI_ENVIRONMENT: 'prod' | |
APP_TITLE: 'Vocdoni' | |
ETH_NETWORK_ID: 'xdai' | |
BLOCK_TIME: '12' | |
BOOTNODES_URL: 'https://raw.githubusercontent.com/vocdoni/bootnodes/main/content/gateways.priv.json' | |
BACKEND_URL: 'https://backend.vocdoni.net/api/manager' | |
BACKEND_PUB_KEY: '03cd13285ea116b9093a47364b29ddb09eccf50aa2f0112b6084a0b10943964d4e' | |
DISCOVERY_POOL_SIZE: '1' | |
ANALYTICS_KEY: ${{ secrets.ANALYTICS_KEY }} | |
ANALYTICS_URL: ${{ secrets.ANALYTICS_URL }} | |
- name: Set up GCloud SDK | |
uses: google-github-actions/setup-gcloud@v1 | |
with: | |
service_account_key: ${{ secrets.GCP_PRODUCTION }} | |
export_default_credentials: true | |
- name: Upload static site to GCP | |
run: | | |
gsutil -m cp -r build/* gs://vocdoni.app | |
gcs-release-production-oc: | |
runs-on: self-hosted | |
environment: production | |
needs: | |
- node-tests | |
if: startsWith(github.ref, 'refs/heads/release-oc') | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
cache: 'npm' | |
- name: Get short commit sha | |
id: var | |
shell: bash | |
run: | | |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Install dependencies and build | |
run: | | |
npm install | |
npm run export | |
env: | |
COMMIT_SHA: ${{ steps.var.outputs.sha_short }} | |
DEVELOPMENT: 'false' | |
VOCDONI_ENVIRONMENT: 'prod' | |
APP_TITLE: 'Vocdoni' | |
ETH_NETWORK_ID: 'xdai' | |
BLOCK_TIME: '12' | |
BOOTNODES_URL: 'https://raw.githubusercontent.com/vocdoni/bootnodes/main/content/gateways.priv.json' | |
BACKEND_URL: 'https://backend.vocdoni.net/api/manager' | |
BACKEND_PUB_KEY: '03cd13285ea116b9093a47364b29ddb09eccf50aa2f0112b6084a0b10943964d4e' | |
DISCOVERY_POOL_SIZE: '1' | |
COLOR_PICKER: '1' | |
ADVANCED_CENSUS: '1' | |
- name: Set up GCloud SDK | |
uses: google-github-actions/setup-gcloud@v1 | |
with: | |
service_account_key: ${{ secrets.GCP_PRODUCTION }} | |
export_default_credentials: true | |
- name: Upload static site to GCP | |
run: | | |
gsutil -m cp -r build/* gs://oc-vocdoni-app | |
gcs-release-production-azeno: | |
runs-on: [self-hosted,ci1] | |
environment: production | |
needs: | |
- node-tests | |
if: startsWith(github.ref, 'refs/heads/release-azeno') | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
cache: 'npm' | |
- name: Get short commit sha | |
id: var | |
shell: bash | |
run: | | |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Install dependencies and build | |
run: | | |
npm install | |
npm run export | |
env: | |
COMMIT_SHA: ${{ steps.var.outputs.sha_short }} | |
DEVELOPMENT: 'false' | |
VOCDONI_ENVIRONMENT: 'prod' | |
APP_TITLE: 'Vocdoni' | |
ETH_NETWORK_ID: 'xdai' | |
BLOCK_TIME: '12' | |
BOOTNODES_URL: 'https://raw.githubusercontent.com/vocdoni/bootnodes/main/content/gateways.azeno.priv.json' | |
BACKEND_URL: 'https://backend.azeno.vocdoni.net/api/manager' | |
BACKEND_PUB_KEY: '03cd13285ea116b9093a47364b29ddb09eccf50aa2f0112b6084a0b10943964d4e' | |
DISCOVERY_POOL_SIZE: '1' | |
EXPLORER_URL: 'https://explorer.vote' | |
ANALYTICS_KEY: ${{ secrets.ANALYTICS_KEY }} | |
ANALYTICS_URL: ${{ secrets.ANALYTICS_URL }} | |
- name: Set up GCloud SDK | |
uses: google-github-actions/setup-gcloud@v1 | |
with: | |
service_account_key: ${{ secrets.GCP_PRODUCTION }} | |
export_default_credentials: true | |
- name: Upload static site to GCP | |
run: | | |
gsutil -m cp -r build/* gs://vocdoni.app | |
gcs-release-staging: | |
runs-on: self-hosted | |
environment: staging | |
needs: | |
- node-tests | |
if: github.ref == 'refs/heads/stage' | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
cache: 'npm' | |
- name: Get short commit sha | |
id: var | |
shell: bash | |
run: | | |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Install dependencies and build (staging) | |
run: | | |
npm install | |
npm run export | |
env: | |
COMMIT_SHA: ${{ steps.var.outputs.sha_short }} | |
DEVELOPMENT: 'false' | |
VOCDONI_ENVIRONMENT: 'stg' | |
APP_TITLE: 'Vocdoni Staging' | |
ETH_NETWORK_ID: 'xdai' | |
BLOCK_TIME: '12' | |
BOOTNODES_URL: 'https://raw.githubusercontent.com/vocdoni/bootnodes/main/content/gateways.stg.priv.json' | |
BACKEND_URL: 'https://manager.stg.vocdoni.net/api/manager' | |
BACKEND_PUB_KEY: '03a0666d3ecd138b85713e240f0d9559b733c723765f6818e14f2f7e4e8c8bdb70' | |
COLOR_PICKER: '1' | |
ADVANCED_CENSUS: '1' | |
DISCOVERY_POOL_SIZE: '1' | |
ANALYTICS_KEY: ${{ secrets.ANALYTICS_KEY }} | |
ANALYTICS_URL: ${{ secrets.ANALYTICS_URL }} | |
- name: Set up GCloud SDK (staging) | |
uses: google-github-actions/setup-gcloud@v1 | |
with: | |
service_account_key: ${{ secrets.GCP_STAGING }} | |
export_default_credentials: true | |
- name: Upload static site to GCP (staging) | |
run: | | |
gsutil -m cp -r build/* gs://stg.vocdoni.app |