actual fix
This commit is contained in:
parent
c356742f19
commit
30bca2f8ba
2 changed files with 44 additions and 63 deletions
73
.github/workflows/ci.yaml
vendored
73
.github/workflows/ci.yaml
vendored
|
|
@ -1,6 +1,8 @@
|
|||
name: CI + Deploy
|
||||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [main]
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
|
|
@ -8,68 +10,13 @@ jobs:
|
|||
ci:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup PNPM
|
||||
uses: pnpm/action-setup@v4
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Prettier check
|
||||
run: pnpm prettier --check .
|
||||
|
||||
- name: Astro check
|
||||
run: pnpm astro check
|
||||
|
||||
- name: Build
|
||||
run: pnpm build
|
||||
|
||||
deploy:
|
||||
needs: ci
|
||||
if: github.ref == 'refs/heads/main'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup PNPM
|
||||
uses: pnpm/action-setup@v4
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Build site
|
||||
run: pnpm build
|
||||
|
||||
- name: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@v2
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
aws-region: us-east-2
|
||||
|
||||
- name: Deploy static site to S3 bucket
|
||||
run: |
|
||||
chmod +x scripts/deploy.sh
|
||||
scripts/deploy.sh
|
||||
|
||||
- name: Invalidate CloudFront cache
|
||||
env:
|
||||
AWS_CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }}
|
||||
run: |
|
||||
chmod +x scripts/invalidate.sh
|
||||
scripts/invalidate.sh
|
||||
- run: pnpm install
|
||||
- run: pnpm prettier --check .
|
||||
- run: pnpm astro check
|
||||
- run: pnpm build
|
||||
|
|
|
|||
34
.github/workflows/deploy.yaml
vendored
Normal file
34
.github/workflows/deploy.yaml
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
name: Deploy
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["CI"]
|
||||
types:
|
||||
- completed
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
if: >
|
||||
github.event.workflow_run.conclusion == 'success' &&
|
||||
github.event.workflow_run.pull_requests[0].base.ref == 'main'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: "pnpm"
|
||||
- run: pnpm install
|
||||
- run: pnpm build
|
||||
- uses: aws-actions/configure-aws-credentials@v2
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
aws-region: us-east-2
|
||||
- run: |
|
||||
chmod +x scripts/deploy.sh
|
||||
scripts/deploy.sh
|
||||
- run: |
|
||||
chmod +x scripts/invalidate.sh
|
||||
scripts/invalidate.sh
|
||||
Loading…
Add table
Add a link
Reference in a new issue