-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
76 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
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 | ||
working-directory: ./website | ||
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 | ||
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 | ||
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 |