Skip to content

Commit

Permalink
chore: add Github action workflow (#11)
Browse files Browse the repository at this point in the history
* Add workflows

* Add permissions to workflow

* Fix ARN format

* Change ARN

* Test s3 sync

* Add cache invalidation

* Fix cache invalidation command

* Update ARN

* Finalise workflows
  • Loading branch information
huijing authored Oct 2, 2023
1 parent f05fcf7 commit e5b1dce
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 14 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ permissions:
id-token: write

jobs:
build:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout your repository using git
Expand All @@ -24,12 +24,12 @@ jobs:
with:
node-version: 18

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-2
role-to-assume: arn:aws:iam::${{ secrets.ACCOUNT_ID }}:role/GitHubAction-AssumeRoleWithAction
role-session-name: GitHub_to_AWS_via_FederatedOIDC
aws-region: ${{ vars.AWS_REGION }}

- uses: oven-sh/setup-bun@v1
- name: Install dependencies
Expand All @@ -39,3 +39,7 @@ jobs:

- name: Deploy to S3
run: aws s3 sync ./dist/ s3://${{ secrets.BUCKET_ID }}

- name: Invalidate CloudFront cache
run: |
aws cloudfront create-invalidation --distribution-id ${{ secrets.DISTRIBUTION_ID }} --paths "/developers/*"
19 changes: 13 additions & 6 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,24 @@ on:
pull_request:
branches:
- main
# Review gh actions docs if you want to further define triggers, paths, etc
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on

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

jobs:
test-deploy:
name: Test deployment
build:
name: Test build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1
- name: Checkout your repository using git
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18

- uses: oven-sh/setup-bun@v1
- name: Install dependencies
run: bun install
- name: Test build website
Expand Down
Binary file modified bun.lockb
Binary file not shown.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
},
"dependencies": {
"@astrojs/react": "^3.0.2",
"@astrojs/starlight": "^0.10.2",
"@astrojs/starlight": "^0.10.3",
"@interledger/docs-design-system": "^0.0.12",
"@types/react": "^18.2.23",
"@types/react": "^18.2.24",
"@types/react-dom": "^18.2.8",
"astro": "^3.2.0",
"react": "^18.2.0",
Expand Down

0 comments on commit e5b1dce

Please sign in to comment.