Skip to content

Commit

Permalink
Replace Travis with Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Giacomo Licari committed Jan 10, 2024
1 parent c71003e commit a35c882
Showing 8 changed files with 96 additions and 47 deletions.
95 changes: 95 additions & 0 deletions .github/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Deploy

# Run on pushes to main or PRs
on:
# Pull request hook without any config. Launches for every pull request
pull_request:
# Launches for pushes to main or dev
push:
branches:
- main
- dev
- release
# Launches build when release is published
release:
types: [published]

jobs:
deploy:
name: Deployment
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./website

steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- 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
- uses: actions/checkout@v2
with:
fetch-depth: 0

- 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
run: yarn build

- name: Configure AWS Development credentials
uses: aws-actions/configure-aws-credentials@v1
if: ( github.ref == 'refs/heads/dev' || github.ref == '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: ( github.ref == 'refs/heads/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'
if: github.ref == 'refs/heads/dev'
run: |
aws s3 sync build/ s3://${{ secrets.DEV_BUCKET_NAME }}/dev --exclude "*.html" --cache-control max-age=0,no-cache,no-store,public
aws s3 sync build/ 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 staging environment
- name: 'Deploy to S3: Staging'
if: github.ref == 'refs/heads/main'
run: |
aws s3 sync build/ s3://${{ secrets.DEV_BUCKET_NAME }}/staging --exclude "*.html" --cache-control max-age=0,no-cache,no-store,public
aws s3 sync build/ s3://${{ secrets.DEV_BUCKET_NAME }}/staging --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'
if: github.ref == 'refs/heads/release'
run: |
aws s3 sync build/ s3://${{ secrets.RELEASE_BUCKET_NAME }} --delete --exclude "*.html" --exclude "sitemap.xml" --cache-control max-age=86400,public
aws s3 sync build/ s3://${{ secrets.RELEASE_BUCKET_NAME }} --delete --exclude "*" --include "*.html" --cache-control max-age=0,no-cache,no-store,must-revalidate --content-type text/html
aws s3 sync build/ s3://${{ secrets.RELEASE_BUCKET_NAME }} --delete --exclude "*" --include "sitemap.xml" --cache-control max-age=0,no-cache,no-store,must-revalidate --content-type text/xml
2 changes: 0 additions & 2 deletions .idea/.gitignore

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/gnosis-docs.iml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

17 changes: 0 additions & 17 deletions travis/prepare_production_deployment.sh

This file was deleted.

1 change: 1 addition & 0 deletions website/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16.14

0 comments on commit a35c882

Please sign in to comment.