This repository has been archived by the owner on Sep 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from ror-community/add-staging-prod-envs
add staging and prod deployment actions
- Loading branch information
Showing
4 changed files
with
107 additions
and
0 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,44 @@ | ||
name: Release | ||
on: | ||
release: | ||
types: [published] | ||
paths-ignore: | ||
- '**/README.md' | ||
- '**/workflows/**' | ||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install | ||
run: npm ci | ||
- name: Build | ||
run: | | ||
cp src/env.prod.ts src/env.ts; | ||
npm run build | ||
- name: Deploy | ||
uses: reggionick/[email protected] | ||
with: | ||
folder: dist | ||
bucket: ${{ secrets.S3_BUCKET_CURATORFORM_PROD}} | ||
bucket-region: ${{ secrets.S3_BUCKET_REGION }} | ||
dist-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID_CURATORFORM_PROD }} | ||
invalidation: /* | ||
delete-removed: true | ||
- name: Notify Slack | ||
if: always() | ||
uses: edge/simple-slack-notify@master | ||
with: | ||
channel: "#deployment-updates" | ||
color: 'good' | ||
text: "A new version of the <https://leo.ror.org|LEO FORM> is deployed to production." | ||
failure_text: '${env.GITHUB_WORKFLOW} (${env.GITHUB_RUN_NUMBER}) build failed' | ||
fields: | | ||
[{ "title": "Commit message", "value": "${{ steps.extract_variables.outputs.MESSAGE }}" }, | ||
{ "title": "Committed by", "value": "<https://github.com/${{ github.repository }}/commits?author=${{ github.actor }}|${{ github.actor }}>", "short": true }, | ||
{ "title": "Commit SHA", "value": "<https://github.com/${{ github.repository }}/commit/${{ steps.extract_variables.outputs.GIT_SHA }}|${{ steps.extract_variables.outputs.GIT_SHA_SHORT }}>", "short": true }, | ||
{ "title": "Repository", "value": "<https://github.com/${{ github.repository }}|${{ github.repository }}>", "short": true }, | ||
{ "title": "Branch", "value": "<https://github.com/${{ github.repository }}/tree/${{ steps.extract_variables.outputs.BRANCH }}|${{ steps.extract_variables.outputs.BRANCH }}>", "short": true }] |
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,45 @@ | ||
name: Deploy Staging | ||
on: | ||
push: | ||
branches: | ||
- "staging" | ||
paths-ignore: | ||
- '**/README.md' | ||
- '**/workflows/**' | ||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install | ||
run: npm ci | ||
- name: Build | ||
run: | | ||
cp src/env.staging.ts src/env.ts; | ||
npm run build | ||
- name: Deploy | ||
uses: reggionick/[email protected] | ||
with: | ||
folder: dist | ||
bucket: ${{ secrets.S3_BUCKET_CURATORFORM_STAGING}} | ||
bucket-region: ${{ secrets.S3_BUCKET_REGION }} | ||
dist-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID_CURATORFORM_STAGING }} | ||
invalidation: /* | ||
delete-removed: true | ||
- name: Notify Slack | ||
if: always() | ||
uses: edge/simple-slack-notify@master | ||
with: | ||
channel: "#deployment-updates" | ||
color: 'good' | ||
text: "A new version of the <https://leo.staging.ror.org|LEO FORM> is deployed to staging." | ||
failure_text: '${env.GITHUB_WORKFLOW} (${env.GITHUB_RUN_NUMBER}) build failed' | ||
fields: | | ||
[{ "title": "Commit message", "value": "${{ steps.extract_variables.outputs.MESSAGE }}" }, | ||
{ "title": "Committed by", "value": "<https://github.com/${{ github.repository }}/commits?author=${{ github.actor }}|${{ github.actor }}>", "short": true }, | ||
{ "title": "Commit SHA", "value": "<https://github.com/${{ github.repository }}/commit/${{ steps.extract_variables.outputs.GIT_SHA }}|${{ steps.extract_variables.outputs.GIT_SHA_SHORT }}>", "short": true }, | ||
{ "title": "Repository", "value": "<https://github.com/${{ github.repository }}|${{ github.repository }}>", "short": true }, | ||
{ "title": "Branch", "value": "<https://github.com/${{ github.repository }}/tree/${{ steps.extract_variables.outputs.BRANCH }}|${{ steps.extract_variables.outputs.BRANCH }}>", "short": true }] |
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,9 @@ | ||
export const env = () => { | ||
const { | ||
VUE_APP_BASE_ROUTE: BASE_ROUTE = '/', | ||
VUE_APP_GENERATE_ID: GENERATE_ID = 'https://generateid.ror.org/generateid', | ||
VUE_APP_ADDRESS_URL: ADDRESS_URL = 'https://generateid.ror.org/address', | ||
NODE_ENV | ||
} = process.env | ||
return { BASE_ROUTE, GENERATE_ID, ADDRESS_URL, NODE_ENV } | ||
} |
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,9 @@ | ||
export const env = () => { | ||
const { | ||
VUE_APP_BASE_ROUTE: BASE_ROUTE = '/', | ||
VUE_APP_GENERATE_ID: GENERATE_ID = 'https://generateid.staging.ror.org/generateid', | ||
VUE_APP_ADDRESS_URL: ADDRESS_URL = 'https://generateid.staging.ror.org/address', | ||
NODE_ENV | ||
} = process.env | ||
return { BASE_ROUTE, GENERATE_ID, ADDRESS_URL, NODE_ENV } | ||
} |