Skip to content

Commit

Permalink
feat: add github actions for test deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
williamh890 committed Jun 20, 2024
1 parent b303fe8 commit 3ca5fce
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 1 deletion.
21 changes: 21 additions & 0 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Update BulkDownload Stack (prod)

on:
push:
branches:
- prod

jobs:
deploy:
runs-on: ubuntu-latest
environment: test

steps:
- name: Checkout
uses: actions/checkout@v4

- name: build
uses: ./.github/workflows/bulk-download-deploy-composite
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
25 changes: 25 additions & 0 deletions .github/workflows/deploy-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Update BulkDownload Stack (test)

on:
push:
branches:
- actions

jobs:
deploy:
runs-on: ubuntu-latest
environment: test

steps:
- name: Checkout
uses: actions/checkout@v4

- name: build
uses: ./.github/workflows/bulk-download-deploy-composite
with:
maturity: test
application: ${{ vars.APPLICATION }}
cdn-id: ${{ vars.CDN_ID }}
s3-bucket: ${{ vars.S3_BUCKET }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
60 changes: 60 additions & 0 deletions .github/workflows/search-ui-composite/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Composite search-ui deploy action

inputs:
maturity:
required: true
type: string
application:
required: true
type: string
cdn-id:
required: true
type: string
s3-bucket:
required: true
type: string
aws-access-key-id:
required: true
type: string
aws-secret-access-key:
required: true
type: string

runs:
using: "composite"
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install dependencies
shell: bash
run: |
cp src/app/services/envs/env-${{ inputs.maturity }}.ts src/app/services/env.ts
echo "{\"hash\":\"${{ github.sha }}\"}" > src/assets/commit-hash.json
npm install -g @angular/[email protected]
npm install
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ inputs.aws-access-key-id }}
aws-secret-access-key: ${{ inputs.aws-secret-access-key }}
aws-region: "us-east-1"

- name: Angular Build
run: |
ng build --configuration production
- name: Deploy to AWS
shell: bash
run: |
cd dist/${{ inputs.application }}
aws s3 sync . "s3://${{ inputs.s3-bucket }}"
aws cloudfront create-invalidation \
--distribution-id ${{ inputs.cdn-id }} \
--paths /index.html /manifest.json /ngsw.json /favicon.ico /assets/i18n/* /assets/* /docs/*
2 changes: 1 addition & 1 deletion buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ phases:
commands:
- n 18
- npm set progress=false
- npm install -g @angular/cli@15.2.7
- npm install -g @angular/cli@17.2.7
pre_build:
commands:
- cp src/app/services/envs/env-${MATURITY}.ts src/app/services/env.ts
Expand Down

0 comments on commit 3ca5fce

Please sign in to comment.