diff --git a/.github/workflows/deploy-frontend.yaml b/.github/workflows/deploy-docs.yaml similarity index 69% rename from .github/workflows/deploy-frontend.yaml rename to .github/workflows/deploy-docs.yaml index 86a63a6..29a9bc1 100644 --- a/.github/workflows/deploy-frontend.yaml +++ b/.github/workflows/deploy-docs.yaml @@ -1,11 +1,10 @@ -name: Wallet Frontend Deployment +name: Website Docs Deployment on: push: branches: - dev - staging - - demo - master permissions: @@ -17,9 +16,12 @@ jobs: runs-on: ubuntu-latest environment: ${{ github.ref == 'refs/heads/master' && 'prod' || github.ref == 'refs/heads/staging' && 'staging' || github.ref == 'refs/heads/dev' && 'dev' }} env: - PRODUCT: docs - APPLICATION: frontend - AWS_DEFAULT_REGION: eu-west-1 + AWS_ACCOUNT_ID: ${{ vars.AWS_ACCOUNT_ID }} + AWS_REGION: ${{ vars.AWS_REGION }} + PRODUCT: ${{ vars.PRODUCT }} + APPLICATION: ${{ vars.APPLICATION }} + ENVIRONMENT: ${{ vars.ENVIRONMENT }} + AWS_S3_BUCKET: ${{ vars.PRODUCT }}-${{ vars.APPLICATION }}-${{ vars.ENVIRONMENT }}-${{ vars.AWS_ACCOUNT_ID }}-${{ vars.AWS_REGION }} BUILD_DIR: ./build ALGOLIA_API_KEY: ${{ vars.ALGOLIA_API_KEY }} ALGOLIA_APP_ID: ${{ vars.ALGOLIA_APP_ID }} @@ -32,27 +34,6 @@ jobs: with: node-version: '20' - - name: Set dev ENV - if: github.ref == 'refs/heads/dev' - run: | - echo "ENV=dev" >> $GITHUB_ENV - echo "AWS_ACCOUNT_ID=759055860286" >> $GITHUB_ENV - echo "AWS_S3_BUCKET=docs-frontend-dev-759055860286-eu-west-1" >> $GITHUB_ENV - - - name: Set staging ENV - if: github.ref == 'refs/heads/staging' - run: | - echo "ENV=staging" >> $GITHUB_ENV - echo "AWS_ACCOUNT_ID=924226199168" >> $GITHUB_ENV - echo "AWS_S3_BUCKET=docs-frontend-staging-924226199168-eu-west-1" >> $GITHUB_ENV - - - name: Set prod ENV - if: github.ref == 'refs/heads/master' - run: | - echo "ENV=prod" >> $GITHUB_ENV - echo "AWS_ACCOUNT_ID=255525589248" >> $GITHUB_ENV - echo "AWS_S3_BUCKET=docs-frontend-prod-255525589248-eu-west-1" >> $GITHUB_ENV - - name: Prepare .npmrc run: | echo "//npm.pkg.github.com/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}" >> .npmrc @@ -67,8 +48,8 @@ jobs: - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 with: - role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/${{ env.PRODUCT }}-${{ env.APPLICATION }}-deployer-${{ env.AWS_DEFAULT_REGION }}-${{ env.ENV }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} + role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/${{ env.PRODUCT }}-${{ env.APPLICATION }}-deployer-${{ env.AWS_REGION }}-${{ env.ENVIRONMENT }} + aws-region: ${{ env.AWS_REGION }} - name: Deploy to S3 run: | @@ -79,7 +60,7 @@ jobs: cloudfrontdistids=$(aws cloudfront list-distributions | jq -r ".DistributionList.Items[].ARN") for dist in $cloudfrontdistids; do if [ $(aws cloudfront list-tags-for-resource --resource $dist --query "Tags.Items[?Key=='Application'].Value[]" --output text) == ${{ env.APPLICATION }} ] && - [ $(aws cloudfront list-tags-for-resource --resource $dist --query "Tags.Items[?Key=='Environment'].Value[]" --output text) == ${{ env.ENV }} ]; then + [ $(aws cloudfront list-tags-for-resource --resource $dist --query "Tags.Items[?Key=='Environment'].Value[]" --output text) == ${{ env.ENVIRONMENT }} ]; then CLOUDFRONT_DISTRIBUTION_IDS="$CLOUDFRONT_DISTRIBUTION_IDS ${dist##*/}" fi done