Skip to content

Commit

Permalink
Merge pull request #77 from courtcanva/feature/cc-30
Browse files Browse the repository at this point in the history
feat: add github action pipeline
  • Loading branch information
kornzhoudev authored May 31, 2023
2 parents 07c8cba + dc80ef0 commit 43888ee
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 2 deletions.
17 changes: 17 additions & 0 deletions .github/actions/cached-dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "Get & Cache Dependencies"
description: "Get the dependencies (via npm) and cache them"
runs:
using: "composite"
steps:
- name: Cache Dependencies
id: cache
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
- name: Install Dependencies
id: install
if: steps.cache.outputs.cache-hit != 'true'
run: |
npm ci
shell: bash
79 changes: 79 additions & 0 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: cc-frontend
on:
pull_request:
branches:
- main
permissions:
id-token: write
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Get code
uses: actions/checkout@v3
- name: Load & cache dependencies
id: cache-dependencies
uses: ./.github/actions/cached-dependencies
- name: Build website
run: npm run build
- name: Build export
run: npm run export
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: out-files
path: out

lint:
needs: build
runs-on: ubuntu-latest
steps:
- name: Get code
uses: actions/checkout@v3
- name: Load & cache dependencies
id: cache-dependencies
uses: ./.github/actions/cached-dependencies
- name: Lint code
run: npm run lint

deploy-uat:
needs: lint
runs-on: ubuntu-latest
steps:
- name: Get code
uses: actions/checkout@v3
- name: Get build artifacts
uses: actions/download-artifact@v3
with:
name: out-files
path: out
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::245866473499:role/OIDC-S3-deployment
aws-region: ap-southeast-2
- name: Deploy to PROD S3
run: |
aws s3 sync out ${{ secrets.S3_UAT_ADMIN_BUCKET }}
deploy-prod:
needs: deploy-uat
runs-on: ubuntu-latest
steps:
- name: Get code
uses: actions/checkout@v3
- name: Get build artifacts
uses: actions/download-artifact@v3
with:
name: out-files
path: out
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::245866473499:role/OIDC-S3-deployment
aws-region: ap-southeast-2
- name: Deploy to PROD S3
run: |
aws s3 sync out ${{ secrets.S3_PROD_ADMIN_BUCKET }}
5 changes: 3 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 43888ee

Please sign in to comment.