use specific projectId #57
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
name: Deploy | |
on: | |
push: | |
branches: [master] | |
tags: [v*] | |
release: | |
types: [published] | |
jobs: | |
deploy: | |
name: Deployment | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./packages/app | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
- name: Cache yarn cache | |
uses: actions/cache@v2 | |
with: | |
path: "**/node_modules" | |
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | |
- name: Install dependencies | |
run: yarn install | |
- name: Build website | |
run: yarn static | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_DEFAULT_REGION }} | |
# Script to deploy to the dev environment | |
- name: 'Deploy to S3: Dev' | |
if: github.ref == 'refs/heads/master' | |
run: aws s3 sync out s3://${{ secrets.AWS_DEV_BUCKET_NAME }}/current --delete | |
- name: Get the version | |
id: get_version | |
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) | |
# Script to upload release files | |
- name: 'Upload release build files for production' | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: aws s3 sync out s3://${{ secrets.AWS_DEV_BUCKET_NAME }}/releases/${{ steps.get_version.outputs.VERSION }} --delete | |
# Script to prepare production deployments | |
- run: bash ./.github/scripts/prepare_production_deployment.sh | |
if: success() && startsWith(github.ref, 'refs/tags/v') | |
working-directory: ./ | |
env: | |
PROD_DEPLOYMENT_HOOK_TOKEN: ${{ secrets.PROD_DEPLOYMENT_HOOK_TOKEN }} | |
PROD_DEPLOYMENT_HOOK_URL: ${{ secrets.PROD_DEPLOYMENT_HOOK_URL }} | |
VERSION_TAG: ${{ steps.get_version.outputs.VERSION }} |