summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorJoe Carstairs <65492573+joeacarstairs@users.noreply.github.com>2024-03-30 19:38:32 +0000
committerGitHub <noreply@github.com>2024-03-30 19:38:32 +0000
commit4da57a228d7a796d3e5c221a330538c9f6f74968 (patch)
treede183ff7d5505553fcab982b113a54fc1353da77 /.github
parentad32cd2200138b4a57d5d9088672f32a8e7bd2c3 (diff)
Create build-and-deploy.yml
Diffstat (limited to '.github')
-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