-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
72 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
set -ev | ||
|
||
# Only: | ||
# - Tagged commits | ||
# - Security env variables are available. | ||
if [ -n "$VERSION_TAG" ] && [ -n "$PROD_DEPLOYMENT_HOOK_TOKEN" ] && [ -n "$PROD_DEPLOYMENT_HOOK_URL" ] | ||
then | ||
curl --silent --output /dev/null --write-out "%{http_code}" -X POST \ | ||
-F token="$PROD_DEPLOYMENT_HOOK_TOKEN" \ | ||
-F ref=master \ | ||
-F "variables[TRIGGER_RELEASE_COMMIT_TAG]=$VERSION_TAG" \ | ||
$PROD_DEPLOYMENT_HOOK_URL | ||
else | ||
echo "[ERROR] Production deployment could not be prepared" | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Release | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
permissions: write-all | ||
|
||
name: Deploy release | ||
|
||
steps: | ||
- name: Cancel previous runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
|
||
- name: Install dependencies | ||
shell: bash | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: Build app | ||
shell: bash | ||
run: pnpm build | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v3 | ||
with: | ||
role-to-assume: ${{ secrets.AWS_ROLE }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
|
||
# Deploy the main branch to production environment | ||
- name: Deploy to the production S3 | ||
if: github.ref == 'refs/heads/main' | ||
env: | ||
BUCKET: s3://${{ secrets.AWS_STAGING_BUCKET_NAME }}/releases/${{ github.event.release.tag_name }} | ||
run: bash ./.github/scripts/s3_upload.sh | ||
|
||
# Script to prepare production deployments | ||
- run: bash ./.github/scripts/prepare_production_deployment.sh | ||
env: | ||
PROD_DEPLOYMENT_HOOK_TOKEN: ${{ secrets.PROD_DEPLOYMENT_HOOK_TOKEN }} | ||
PROD_DEPLOYMENT_HOOK_URL: ${{ secrets.PROD_DEPLOYMENT_HOOK_URL }} | ||
VERSION_TAG: ${{ github.event.release.tag_name }} |
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