-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup GitHub action to deploy site to core cloud s3 bucket (#446)
* 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
1 parent
a97a62d
commit 1f85efc
Showing
3 changed files
with
192 additions
and
111 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,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 |
Oops, something went wrong.