74 lines
1.9 KiB
YAML
74 lines
1.9 KiB
YAML
name: deploy
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- v*
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
deploy-site:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout the Repository
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v2
|
|
with:
|
|
node-version: 20
|
|
|
|
- name: Install Rust Toolchain
|
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
env:
|
|
RUSTUP_PERMIT_COPY_RENAME:
|
|
with:
|
|
toolchain: stable
|
|
target: wasm32-unknown-unknown
|
|
cache: false
|
|
|
|
- name: Install Trunk
|
|
uses: jetli/trunk-action@v0.4.0
|
|
with:
|
|
version: "latest"
|
|
|
|
- name: Build Hydrating Application
|
|
run: trunk build --release --features hydration
|
|
|
|
- name: Perform Site Generation
|
|
run: cargo run --release --features static --bin site-build
|
|
|
|
- name: Synchronize with S3 Bucket
|
|
uses: jakejarvis/s3-sync-action@v0.5.1
|
|
with:
|
|
args: --delete
|
|
env:
|
|
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
AWS_REGION: "eu-west-1"
|
|
SOURCE_DIR: "output"
|
|
|
|
- name: Create CloudFront Invalidation
|
|
run: |
|
|
aws configure --profile cloudfront <<-EOF >/dev/null 2>&1
|
|
${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
eu-west-1
|
|
text
|
|
EOF
|
|
|
|
aws cloudfront create-invalidation \
|
|
--distribution-id "${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }}" \
|
|
--paths '/*' \
|
|
--profile cloudfront
|
|
|
|
aws configure --profile cloudfront <<-EOF >/dev/null 2>&1
|
|
null
|
|
null
|
|
null
|
|
text
|
|
EOF
|