Skip to content

Commit

Permalink
Setup GitHub action to deploy site to core cloud s3 bucket (#446)
Browse files Browse the repository at this point in the history
* Add github action to do a dry run deployment to core cloud

* Match environment in SEGAS repo

* Remove dry-run

* Add cypress testing step

* Switch to trigger on push to main

* npm audit fix

* Add technical decision log row

* Grammar

* GitHib typo
  • Loading branch information
jeff-horton-ho-sas authored Sep 13, 2024
1 parent a97a62d commit 1f85efc
Show file tree
Hide file tree
Showing 3 changed files with 192 additions and 111 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/deploy-to-core-cloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Deploy to Core Cloud

on:
push:
branches:
- main

permissions:
contents: read
id-token: write
actions: read

env:
CYPRESS_TEST_URL: localhost
CYPRESS_TEST_PORT: 8080

jobs:
s3-sync:
name: Build, test, and sync to S3
environment:
name: core-cloud
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.sha }}

- name: Configure AWS IdP credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ vars.AWS_ACCOUNT_ID }}:role/${{ vars.AWS_DEPLOYMENT_ROLE }}
role-session-name: GitHubActions
retry-max-attempts: 5
aws-region: eu-west-2

- name: Setup NPM cache
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: Build site, run Cypress tests
uses: cypress-io/github-action@v6
with:
browser: chrome
build: npm run build
start: npm run serve -- --port ${{ env.CYPRESS_TEST_PORT }}
wait-on: 'http://${{ env.CYPRESS_TEST_URL }}:${{ env.CYPRESS_TEST_PORT }}'
config: 'video=false,screenshotOnRunFailure=false'
env:
CYPRESS_TEST_URL: ${{ env.CYPRESS_TEST_URL }}
CYPRESS_TEST_PORT: ${{ env.CYPRESS_TEST_PORT }}

- name: Sync site to S3 bucket
working-directory: ./_site
run: |
aws s3 sync . s3://${{ vars.S3_BUCKET_NAME }}/ --delete
Loading

0 comments on commit 1f85efc

Please sign in to comment.