From fc4681b59c0c5f766adc8ce4ae6caf1aa8c15bef Mon Sep 17 00:00:00 2001 From: atif Date: Tue, 31 Dec 2024 18:01:40 +0500 Subject: [PATCH 1/4] adding prod_manual_deploy.yml for manual deploy --- .github/workflows/prod_manual_deploy.yml | 77 ++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .github/workflows/prod_manual_deploy.yml diff --git a/.github/workflows/prod_manual_deploy.yml b/.github/workflows/prod_manual_deploy.yml new file mode 100644 index 0000000..86b22bf --- /dev/null +++ b/.github/workflows/prod_manual_deploy.yml @@ -0,0 +1,77 @@ +name: Manual Deployment to Production + +on: + workflow_dispatch: + inputs: + tag: + description: Tagged version to deploy + required: true + type: string + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + deploy: + name: Deployment + runs-on: ubuntu-latest + + steps: + - name: Remove broken apt repos [Ubuntu] + if: ${{ matrix.os }} == 'ubuntu-latest' + run: | + for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done + + # Ref: https://github.com/actions/checkout/issues/1471#issuecomment-1771231294 + - uses: actions/checkout@v4 + + - name: Tag checkout + run: | + git fetch --prune --unshallow --tags + git checkout ${{ github.event.inputs.tag }} + + - uses: actions/cache@v2 + with: + path: '**/node_modules' + key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} + + - name: Setup Node.js + uses: actions/setup-node@v2 + + - name: Install + run: | + rm -rf .cache + rm -rf build + yarn config set cache-folder .yarn + yarn install + pip install awscli --upgrade --user + + - name: Build App + working-directory: ./website + run: yarn build + + - name: Configure AWS Development credentials + uses: aws-actions/configure-aws-credentials@v1 + if: startsWith(github.event.ref, 'refs/heads/dev') || github.event_name == 'refs/heads/main' + with: + aws-access-key-id: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.DEV_AWS_DEFAULT_REGION }} + + - name: Configure AWS Production credentials + uses: aws-actions/configure-aws-credentials@v1 + if: startsWith(github.event.ref, 'refs/tags/v') || github.event_name == 'release' + with: + aws-access-key-id: ${{ secrets.PROD_AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.PROD_AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.PROD_AWS_DEFAULT_REGION }} + + # Script to deploy to release environment + - name: 'Deploy to S3: Release' + working-directory: ./website + if: startsWith(github.event.ref, 'refs/tags/v') || github.event_name == 'release' + run: | + aws s3 sync build/gnosis-docs s3://${{ secrets.RELEASE_BUCKET_NAME }}/conditionaltokens --delete --exclude "*.html" --exclude "sitemap.xml" --cache-control max-age=86400,public + aws s3 sync build/gnosis-docs s3://${{ secrets.RELEASE_BUCKET_NAME }}/conditionaltokens --delete --exclude "*" --include "*.html" --cache-control max-age=0,no-cache,no-store,must-revalidate --content-type text/html + aws s3 sync build/gnosis-docs s3://${{ secrets.RELEASE_BUCKET_NAME }}/conditionaltokens --delete --exclude "*" --include "sitemap.xml" --cache-control max-age=0,no-cache,no-store,must-revalidate --content-type text/xml \ No newline at end of file From eb5e24ebc11f282574f0232afdbca072fcc28599 Mon Sep 17 00:00:00 2001 From: atif Date: Tue, 31 Dec 2024 18:12:58 +0500 Subject: [PATCH 2/4] adding prod_manual_deploy.yml for manual deploy --- .github/workflows/prod_manual_deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/prod_manual_deploy.yml b/.github/workflows/prod_manual_deploy.yml index 86b22bf..fb400b5 100644 --- a/.github/workflows/prod_manual_deploy.yml +++ b/.github/workflows/prod_manual_deploy.yml @@ -40,6 +40,7 @@ jobs: uses: actions/setup-node@v2 - name: Install + working-directory: ./website run: | rm -rf .cache rm -rf build From cc6f9dfffc138b8ebc54c18882039e9dfd3eaac7 Mon Sep 17 00:00:00 2001 From: atif Date: Tue, 31 Dec 2024 18:30:00 +0500 Subject: [PATCH 3/4] adding prod_manual_deploy.yml for manual deploy --- .github/workflows/prod_manual_deploy.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/prod_manual_deploy.yml b/.github/workflows/prod_manual_deploy.yml index fb400b5..c54062a 100644 --- a/.github/workflows/prod_manual_deploy.yml +++ b/.github/workflows/prod_manual_deploy.yml @@ -68,6 +68,14 @@ jobs: aws-secret-access-key: ${{ secrets.PROD_AWS_SECRET_ACCESS_KEY }} aws-region: ${{ secrets.PROD_AWS_DEFAULT_REGION }} + # Script to deploy to development environment + - name: 'Deploy to S3: Development' + working-directory: ./website + if: github.ref == 'refs/heads/dev' + run: | + aws s3 sync build/gnosis-docs s3://${{ secrets.DEV_BUCKET_NAME }}/dev/conditionaltokens --exclude "*.html" --cache-control max-age=0,no-cache,no-store,public + aws s3 sync build/gnosis-docs s3://${{ secrets.DEV_BUCKET_NAME }}/dev --exclude "*" --include "*.html" --cache-control max-age=0,no-cache,no-store,must-revalidate --content-type text/html + # Script to deploy to release environment - name: 'Deploy to S3: Release' working-directory: ./website From e73aa18ab82446049bca61df31fc88efd3cdc5cc Mon Sep 17 00:00:00 2001 From: atif Date: Tue, 31 Dec 2024 18:42:59 +0500 Subject: [PATCH 4/4] adding prod_manual_deploy.yml for manual deploy --- .github/workflows/prod_manual_deploy.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/prod_manual_deploy.yml b/.github/workflows/prod_manual_deploy.yml index c54062a..8e1093a 100644 --- a/.github/workflows/prod_manual_deploy.yml +++ b/.github/workflows/prod_manual_deploy.yml @@ -62,24 +62,14 @@ jobs: - name: Configure AWS Production credentials uses: aws-actions/configure-aws-credentials@v1 - if: startsWith(github.event.ref, 'refs/tags/v') || github.event_name == 'release' with: aws-access-key-id: ${{ secrets.PROD_AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.PROD_AWS_SECRET_ACCESS_KEY }} aws-region: ${{ secrets.PROD_AWS_DEFAULT_REGION }} - # Script to deploy to development environment - - name: 'Deploy to S3: Development' - working-directory: ./website - if: github.ref == 'refs/heads/dev' - run: | - aws s3 sync build/gnosis-docs s3://${{ secrets.DEV_BUCKET_NAME }}/dev/conditionaltokens --exclude "*.html" --cache-control max-age=0,no-cache,no-store,public - aws s3 sync build/gnosis-docs s3://${{ secrets.DEV_BUCKET_NAME }}/dev --exclude "*" --include "*.html" --cache-control max-age=0,no-cache,no-store,must-revalidate --content-type text/html - # Script to deploy to release environment - name: 'Deploy to S3: Release' working-directory: ./website - if: startsWith(github.event.ref, 'refs/tags/v') || github.event_name == 'release' run: | aws s3 sync build/gnosis-docs s3://${{ secrets.RELEASE_BUCKET_NAME }}/conditionaltokens --delete --exclude "*.html" --exclude "sitemap.xml" --cache-control max-age=86400,public aws s3 sync build/gnosis-docs s3://${{ secrets.RELEASE_BUCKET_NAME }}/conditionaltokens --delete --exclude "*" --include "*.html" --cache-control max-age=0,no-cache,no-store,must-revalidate --content-type text/html