Create build-and-deploy.yml
This commit is contained in:
41
.github/workflows/build-and-deploy.yml
vendored
Normal file
41
.github/workflows/build-and-deploy.yml
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
name: Build and deploy
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: ["main"]
|
||||
push:
|
||||
branches: ["main"]
|
||||
workflow_dispatch:
|
||||
|
||||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
|
||||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
|
||||
concurrency:
|
||||
group: "deploy"
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build with Astro and deploy to S3
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
cache: npm
|
||||
cache-dependency-path: package-lock.json
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Build with Astro
|
||||
run: npx astro build
|
||||
- name: Configure AWS credentials
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
with:
|
||||
aws-region: eu-west-2
|
||||
role-to-assume: arn:aws:iam::586397755132:user/personal-website-github-actions
|
||||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
- name: Sync S3 bucket
|
||||
run: aws s3 sync ./dist/ s3://joeac-personal-website --delete
|
||||
Reference in New Issue
Block a user