feat(ci): support fairground / mainnet variables for s3 and do not deploy trading to s3 bucket on main branch

This commit is contained in:
Mikołaj Młodzikowski 2023-05-23 11:20:45 +02:00
parent 70e172045d
commit 7a06c946d1

View File

@ -59,29 +59,39 @@ jobs:
key: ${{ runner.os }}-cache-node-modules-${{ hashFiles('yarn.lock') }} key: ${{ runner.os }}-cache-node-modules-${{ hashFiles('yarn.lock') }}
# https://docs.github.com/en/actions/learn-github-actions/contexts # https://docs.github.com/en/actions/learn-github-actions/contexts
- name: Define variables - name: Define dist variables
if: ${{ github.event_name == 'push' }}
run: | run: |
envName='' envName=''
domain="vega.rocks" domain="vega.rocks"
if [[ "${{ github.event_name }}" = "push" ]]; then bucketName=''
if [[ "${{ github.ref }}" =~ .*release/.* ]]; then if [[ "${{ github.ref }}" =~ .*release/.* ]]; then
envName="$(echo ${{ github.ref }} | rev | cut -d '/' -f 1 | rev)" envName="$(echo ${{ github.ref }} | rev | cut -d '/' -f 1 | rev)"
elif [[ "${{ github.ref }}" =~ .*develop$ ]]; then elif [[ "${{ github.ref }}" =~ .*develop$ ]]; then
envName="stagnet1" envName="stagnet1"
elif [[ "${{ matrix.app}}" = "trading" ]] && [[ ${{ startsWith(github.ref, 'refs/tags/v') && 'true' || 'false' }} = "true" ]]; then
envName="mainnet"
elif [[ "${{ github.ref }}" =~ .*main$ ]]; then elif [[ "${{ github.ref }}" =~ .*main$ ]]; then
envName="mainnet" envName="mainnet"
elif [[ "${{ matrix.app}}" = "trading" ]] && [[ "${{ startsWith(github.ref, 'refs/tags/v') && 'true' || 'false' }}" = "true" ]]; then
envName="mainnet"
fi fi
if [[ "${envName}" = "mainnet" ]]; then if [[ "${envName}" = "mainnet" ]]; then
domain="vega.xyz" domain="vega.xyz"
fi bucketName="${{ matrix.app }}.${domain}"
if [[ "${envName}" = "testnet" ]]; then elif [[ "${envName}" = "testnet" ]]; then
domain="fairground.wtf" domain="fairground.wtf"
bucketName="${{ matrix.app }}.${domain}"
fi fi
if [[ -z "${bucketName}" ]]; then
bucketName="${{ matrix.app }}.${envName}.${domain}" bucketName="${{ matrix.app }}.${envName}.${domain}"
echo BUCKET_NAME=${bucketName} >> $GITHUB_ENV
fi fi
echo "bucket name: ${bucketName}"
echo "env name: ${envName}"
echo BUCKET_NAME=${bucketName} >> $GITHUB_ENV
echo ENV_NAME=${envName} >> $GITHUB_ENV echo ENV_NAME=${envName} >> $GITHUB_ENV
- name: Build local dist - name: Build local dist
@ -158,7 +168,7 @@ jobs:
# bucket creation in github.com/vegaprotocol/terraform//frontend # bucket creation in github.com/vegaprotocol/terraform//frontend
- name: Publish dist to s3 - name: Publish dist to s3
uses: jakejarvis/s3-sync-action@master uses: jakejarvis/s3-sync-action@master
if: ${{ github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/v') }} if: ${{ github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/v') && ( matrix.app != 'trading' || (matrix.app == 'trading' && !endsWith(github.ref, 'main') ) ) }}
with: with:
args: --acl private --follow-symlinks --delete args: --acl private --follow-symlinks --delete
env: env: