summaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/build-and-deploy.yml41
1 files changed, 41 insertions, 0 deletions
diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml
new file mode 100644
index 0000000..f842760
--- /dev/null
+++ b/.github/workflows/build-and-deploy.yml
@@ -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