production-deployment #2
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 to production environment | |
# Controls when the action will run | |
on: | |
# Triggers the workflow on repository-dispatch event | |
repository_dispatch: | |
types: [production-deployment] | |
# Allows to run the workflow manually from the Actions tab | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: Tag or branch to deploy | |
required: false | |
default: main | |
type: string | |
jobs: | |
deploy-app: | |
name: Deploy to production | |
runs-on: ubuntu-latest | |
environment: production | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.client_payload.tag }} | |
- name: Yarn install and Cache dependencies | |
uses: graasp/graasp-deploy/.github/actions/yarn-install-and-cache@v1 | |
- name: Yarn build | |
# Set environment variables required to perform the build. These are only available to this step | |
env: | |
VITE_API_HOST: ${{ vars.VITE_API_HOST }} | |
VITE_GRAASP_APP_KEY: ${{ secrets.APP_KEY }} | |
VITE_SENTRY_ENV: production | |
VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
VITE_VERSION: ${{ github.event.client_payload.tag }} | |
# add any env variable needed by your app here | |
run: yarn build | |
shell: bash | |
- name: Deploy | |
uses: graasp/graasp-deploy/.github/actions/deploy-s3-app@v1 | |
with: | |
# Replace input build-folder or version if needed | |
build-folder: 'build' | |
graasp-app-id: ${{ secrets.APP_ID }} | |
version: 'latest' | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_PROD }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PROD }} | |
aws-region: ${{ vars.APPS_AWS_REGION_PROD }} | |
aws-s3-bucket-name: ${{ vars.AWS_S3_BUCKET_NAME_APPS_PROD }} | |
cloudfront-distribution-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_APPS_PROD }} |