From a9ebb36b9b266fae4d7f7f48355dd78d8bf22f94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20M=C5=82odzikowski?= Date: Wed, 14 Jun 2023 12:37:41 +0200 Subject: [PATCH] feat(ci): deploy ui-toolkit to s3 (#4089) --- .github/workflows/ci-cd-trigger.yml | 7 +++++- .github/workflows/publish-dist.yml | 38 +++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-cd-trigger.yml b/.github/workflows/ci-cd-trigger.yml index f58b29e54..0200f9a9a 100644 --- a/.github/workflows/ci-cd-trigger.yml +++ b/.github/workflows/ci-cd-trigger.yml @@ -152,10 +152,15 @@ jobs: projects+=' "multisig-signer" ' fi if echo "$affected" | grep -q static; then - echo "Static are affected" + echo "static is affected" echo "Deploying static on s3" projects+=' "static" ' fi + if echo "$affected" | grep -q ui-toolkit; then + echo "ui-toolkit is affected" + echo "Deploying ui-toolkit on s3" + projects+=' "ui-toolkit" ' + fi fi projects_e2e=${projects_e2e%?} diff --git a/.github/workflows/publish-dist.yml b/.github/workflows/publish-dist.yml index 127a5daf7..0625fa342 100644 --- a/.github/workflows/publish-dist.yml +++ b/.github/workflows/publish-dist.yml @@ -78,6 +78,10 @@ jobs: envName="mainnet" bucketName="static.vega.xyz" fi + if [[ "${{ matrix.app }}" = "ui-toolkit" ]]; then + envName="mainnet" + bucketName="ui.vega.rocks" + fi elif [[ "${{ github.ref }}" =~ .*main$ ]]; then envName="mainnet" elif [[ "${{ matrix.app}}" = "trading" ]] && [[ "${{ startsWith(github.ref, 'refs/tags/v') && 'true' || 'false' }}" = "true" ]]; then @@ -118,6 +122,9 @@ jobs: if [ "${{ matrix.app }}" = "trading" ]; then yarn nx export trading $flags || (yarn install && yarn nx export trading $flags) DIST_LOCATION=dist/apps/trading/exported + elif [ "${{ matrix.app }}" = "ui-toolkit" ]; then + NODE_ENV=production yarn nx run ui-toolkit:build-storybook + DIST_LOCATION=dist/storybook/ui-toolkit else yarn nx build ${{ matrix.app }} $flags || (yarn install && yarn nx build ${{ matrix.app }} $flags) DIST_LOCATION=dist/apps/${{ matrix.app }} @@ -152,6 +159,8 @@ jobs: - name: Publish dist as docker image (ghcr) uses: docker/build-push-action@v3 + continue-on-error: true + id: ghcr-push if: ${{ github.event_name == 'pull_request' || (matrix.app == 'trading' && github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/v') ) }} with: context: . @@ -165,6 +174,8 @@ jobs: - name: Publish dist as docker image (docker hub) uses: docker/build-push-action@v3 + continue-on-error: true + id: dockerhub-push if: ${{ matrix.app == 'trading' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }} with: context: . @@ -177,6 +188,33 @@ jobs: vegaprotocol/${{ matrix.app }}:${{ github.ref_name }} vegaprotocol/${{ matrix.app }}:mainnet + - name: Publish dist as docker image (ghcr - retry) + uses: docker/build-push-action@v3 + if: ${{ steps.ghcr-push.outcome == 'failure' }} + with: + context: . + file: docker/node-outside-docker.Dockerfile + push: true + build-args: | + APP=${{ matrix.app }} + ENV_NAME=${{ env.ENV_NAME }} + tags: | + ghcr.io/vegaprotocol/frontend/${{ matrix.app }}:${{ github.event.pull_request.head.sha || github.sha }} + + - name: Publish dist as docker image (docker hub - retry) + uses: docker/build-push-action@v3 + if: ${{ steps.dockerhub-push.outcome == 'failure' }} + with: + context: . + file: docker/node-outside-docker.Dockerfile + push: true + build-args: | + APP=${{ matrix.app }} + ENV_NAME=${{ env.ENV_NAME }} + tags: | + vegaprotocol/${{ matrix.app }}:${{ github.ref_name }} + vegaprotocol/${{ matrix.app }}:mainnet + # bucket creation in github.com/vegaprotocol/terraform//frontend - name: Publish dist to s3 uses: jakejarvis/s3-sync-action@master