-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d2afc94
commit 056d027
Showing
4 changed files
with
1,397 additions
and
70 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,83 @@ | ||
name: CI/CD | ||
|
||
on: | ||
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab | ||
pull_request: # Runs whenever a pull request is created or updated | ||
push: # Runs whenever a commit is pushed to the repository | ||
branches: [master] | ||
|
||
concurrency: | ||
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}" | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
contents: write # publish a GitHub release | ||
pages: write # deploy to GitHub Pages | ||
issues: write # comment on released issues | ||
pull-requests: write # comment on released pull requests | ||
|
||
jobs: | ||
sync-s3: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
env: | ||
LEGACY_ACCOUNT_OIDC_ROLE: ${{ secrets.LEGACY_ACCOUNT_OIDC_ROLE }} | ||
AWS_REGION: ${{ secrets.AWS_REGION }} | ||
S3_BUCKET_NAME: ${{ secrets.S3_BUCKET_NAME }} | ||
TRIGGER_DEPLOY: ${{ startsWith(github.ref, 'refs/heads/master') }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: wagoid/commitlint-github-action@v5 | ||
if: github.event_name == 'pull_request' | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
cache: "npm" | ||
node-version-file: ".nvmrc" | ||
|
||
- name: Info | ||
run: | | ||
cat <<EOF | ||
Node version: $(node --version) | ||
NPM version: $(npm --version) | ||
GitHub ref: ${{ github.ref }} | ||
GitHub head ref: ${{ github.head_ref }} | ||
EOF | ||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Build | ||
run: npm run build | ||
|
||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v3 | ||
with: | ||
role-to-assume: ${{ env.LEGACY_ACCOUNT_OIDC_ROLE }} | ||
aws-region: ${{ env.AWS_REGION }} | ||
|
||
- name: Sync "resources" directory with S3 | ||
env: | ||
S3_BUCKET_NAME: ${{ env.S3_BUCKET_NAME }} | ||
run: | | ||
aws s3 sync resources s3://${{ env.S3_BUCKET_NAME }} $([[ "$TRIGGER_DEPLOY" == "false" ]] && echo "--dryrun") | ||
fastly-purge-all: | ||
runs-on: ubuntu-latest | ||
needs: sync-s3 | ||
if: github.ref == 'refs/heads/master' | ||
env: | ||
FASTLY_API_TOKEN: ${{ secrets.FASTLY_KEY }} | ||
FASTLY_SERVICE_ID: ${{ secrets.FASTLY_SERVICE_ID }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Purge Fastly Cache | ||
run: | | ||
curl -X POST -H "Fastly-Key: ${{ secrets.FASTLY_API_TOKEN }}" https://api.fastly.com/service/${{ secrets.FASTLY_SERVICE_ID }}/purge_all |
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 @@ | ||
v16 |
Oops, something went wrong.