Deploy to production environment #37
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 | |
# Control 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: | |
version: | |
type: string | |
description: "Tagged version to deploy" | |
required: true | |
permissions: | |
id-token: write # This is required for requesting the JWT | |
contents: read # This is required for actions/checkout | |
jobs: | |
deploy-app: | |
name: Deploy to production | |
runs-on: ubuntu-latest | |
environment: production | |
concurrency: | |
group: deploy-production | |
cancel-in-progress: true | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.client_payload.tag || inputs.version }} | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
version: 9 | |
run_install: false | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: "package.json" | |
cache: "pnpm" | |
- name: Install dependencies | |
run: pnpm install | |
- name: pnpm build | |
# Set environment variables required to perform the build. These are only available to this step | |
env: | |
VITE_VERSION: ${{ github.event.client_payload.tag || inputs.version }} | |
VITE_GRAASP_DOMAIN: ${{ vars.VITE_GRAASP_DOMAIN }} | |
VITE_GRAASP_API_HOST: ${{ vars.VITE_GRAASP_API_HOST }} | |
VITE_GRAASP_BUILDER_HOST: ${{ vars.VITE_GRAASP_BUILDER_HOST }} | |
VITE_GRAASP_PLAYER_HOST: ${{ vars.VITE_GRAASP_PLAYER_HOST }} | |
VITE_GRAASP_LIBRARY_HOST: ${{ vars.VITE_GRAASP_LIBRARY_HOST }} | |
VITE_GRAASP_ANALYTICS_HOST: ${{ vars.VITE_GRAASP_ANALYZER_HOST }} | |
VITE_SENTRY_ENV: ${{ vars.VITE_SENTRY_ENV }} | |
VITE_SENTRY_DSN: ${{ secrets.VITE_SENTRY_DSN }} | |
VITE_SHOW_NOTIFICATIONS: ${{ vars.VITE_SHOW_NOTIFICATIONS }} | |
VITE_UMAMI_WEBSITE_ID: ${{ secrets.VITE_UMAMI_WEBSITE_ID }} | |
VITE_UMAMI_HOST: ${{ vars.VITE_UMAMI_HOST }} | |
VITE_RECAPTCHA_SITE_KEY: ${{ secrets.VITE_RECAPTCHA_SITE_KEY }} | |
VITE_GRAASP_H5P_INTEGRATION_URL: ${{ vars.VITE_GRAASP_H5P_INTEGRATION_URL }} | |
VITE_GOOGLE_KEY: ${{ secrets.VITE_GOOGLE_KEY }} | |
run: pnpm build | |
shell: bash | |
- name: Deploy | |
uses: graasp/graasp-deploy/.github/actions/deploy-s3@v1 | |
# Replace input build-folder or version if needed | |
with: | |
build-folder: "build" | |
# todo: replace these with the role-to-assume oidc solution | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_PROD }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PROD }} | |
aws-region: ${{ vars.AWS_REGION }} | |
aws-s3-bucket-name: ${{ vars.AWS_S3_BUCKET_NAME }} | |
cloudfront-distribution-id: ${{ vars.AWS_CLOUDFRONT_DISTRIBUTION_ID }} |