Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #12 from ror-community/add-staging-prod-envs
Browse files Browse the repository at this point in the history
add staging and prod deployment actions
  • Loading branch information
lizkrznarich authored Aug 29, 2022
2 parents 9644eff + 2c2d05e commit 0b9f9f3
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
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 }]
45 changes: 45 additions & 0 deletions .github/workflows/staging.yml
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 }]
9 changes: 9 additions & 0 deletions src/env.prod.ts
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 }
}
9 changes: 9 additions & 0 deletions src/env.staging.ts
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 }
}

0 comments on commit 0b9f9f3

Please sign in to comment.