Skip to content

Commit b014c7b

Browse files
authored
ci: add deployment workflows (#17)
1 parent a00ea15 commit b014c7b

File tree

3 files changed

+143
-0
lines changed

3 files changed

+143
-0
lines changed

.github/workflows/deploy-dev.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Deploy to development environment
2+
3+
# Controls when the action will run
4+
on:
5+
# Triggers the workflow on push events only for the main branch
6+
push:
7+
branches:
8+
- main
9+
10+
# Allows to run the workflow manually from the Actions tab
11+
workflow_dispatch:
12+
13+
jobs:
14+
deploy-app:
15+
name: Deploy to dev
16+
runs-on: ubuntu-latest
17+
environment: development
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v3
21+
22+
- name: Yarn install and Cache dependencies
23+
uses: graasp/graasp-deploy/.github/actions/yarn-install-and-cache@v1
24+
25+
- name: Yarn build
26+
# Set environment variables required to perform the build. These are only available to this step
27+
env:
28+
VITE_API_HOST: ${{ vars.API_HOST }}
29+
VITE_GRAASP_APP_KEY: ${{ secrets.APP_KEY }}
30+
VITE_SENTRY_ENV: ${{ vars.SENTRY_ENV }}
31+
VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
32+
VITE_VERSION: ${{ github.sha }}
33+
VITE_WS_HOST: ${{ vars.WS_HOST }}
34+
# add any env variable needed by your app here
35+
run: yarn build
36+
shell: bash
37+
38+
- name: Deploy
39+
uses: graasp/graasp-deploy/.github/actions/deploy-s3-app@v1
40+
with:
41+
# Replace input build-folder or version if needed
42+
build-folder: 'build'
43+
graasp-app-id: ${{ secrets.APP_ID }}
44+
version: 'latest'
45+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_DEV }}
46+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_DEV }}
47+
aws-region: ${{ secrets.APPS_AWS_REGION }}
48+
aws-s3-bucket-name: ${{ secrets.AWS_S3_BUCKET_NAME_APPS_DEV }}
49+
cloudfront-distribution-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_APPS_DEV }}

.github/workflows/deploy-prod.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Deploy to production environment
2+
3+
# Controls when the action will run
4+
on:
5+
# Triggers the workflow on repository-dispatch event
6+
repository_dispatch:
7+
types: [production-deployment]
8+
9+
jobs:
10+
deploy-app:
11+
name: Deploy to production
12+
runs-on: ubuntu-latest
13+
environment: production
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v3
17+
with:
18+
ref: ${{ github.event.client_payload.tag }}
19+
20+
- name: Yarn install and Cache dependencies
21+
uses: graasp/graasp-deploy/.github/actions/yarn-install-and-cache@v1
22+
23+
- name: Yarn build
24+
# Set environment variables required to perform the build. These are only available to this step
25+
env:
26+
VITE_API_HOST: ${{ vars.API_HOST }}
27+
VITE_GRAASP_APP_KEY: ${{ secrets.APP_KEY }}
28+
VITE_SENTRY_ENV: ${{ vars.SENTRY_ENV }}
29+
VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
30+
VITE_VERSION: ${{ github.event.client_payload.tag }}
31+
VITE_WS_HOST: ${{ vars.WS_HOST }}
32+
# add any env variable needed by your app here
33+
run: yarn build
34+
shell: bash
35+
36+
- name: Deploy
37+
uses: graasp/graasp-deploy/.github/actions/deploy-s3-app@v1
38+
with:
39+
# Replace input build-folder or version if needed
40+
build-folder: 'build'
41+
graasp-app-id: ${{ secrets.APP_ID }}
42+
version: 'latest'
43+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_PROD }}
44+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PROD }}
45+
aws-region: ${{ secrets.APPS_AWS_REGION }}
46+
aws-s3-bucket-name: ${{ secrets.AWS_S3_BUCKET_NAME_APPS_PROD }}
47+
cloudfront-distribution-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_APPS_PROD }}

.github/workflows/deploy-stage.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Deploy to staging environment
2+
3+
# Controls when the action will run
4+
on:
5+
# Triggers the workflow on repository-dispatch event
6+
repository_dispatch:
7+
types: [staging-deployment]
8+
9+
jobs:
10+
deploy-app:
11+
name: Deploy to staging
12+
runs-on: ubuntu-latest
13+
environment: staging
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v3
17+
with:
18+
ref: ${{ github.event.client_payload.tag }}
19+
20+
- name: Yarn install and Cache dependencies
21+
uses: graasp/graasp-deploy/.github/actions/yarn-install-and-cache@v1
22+
23+
- name: Yarn build
24+
# Set environment variables required to perform the build. These are only available to this step
25+
env:
26+
VITE_API_HOST: ${{ vars.API_HOST }}
27+
VITE_GRAASP_APP_KEY: ${{ secrets.APP_KEY }}
28+
VITE_SENTRY_ENV: ${{ vars.SENTRY_ENV }}
29+
VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
30+
VITE_VERSION: ${{ github.event.client_payload.tag }}
31+
VITE_WS_HOST: ${{ vars.WS_HOST }}
32+
# add any env variable needed by your app here
33+
run: yarn build
34+
shell: bash
35+
36+
- name: Deploy
37+
uses: graasp/graasp-deploy/.github/actions/deploy-s3-app@v1
38+
with:
39+
# Replace input build-folder or version if needed
40+
build-folder: 'build'
41+
graasp-app-id: ${{ secrets.APP_ID }}
42+
version: 'latest'
43+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGE }}
44+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGE }}
45+
aws-region: ${{ secrets.APPS_AWS_REGION }}
46+
aws-s3-bucket-name: ${{ secrets.AWS_S3_BUCKET_NAME_APPS_STAGE }}
47+
cloudfront-distribution-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_APPS_STAGE }}

0 commit comments

Comments
 (0)