Skip to content

Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows #33

Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows

Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows #33

Workflow file for this run

name: swan.sh s3 deploy
on:
push:
branches:
- main
pull_request:
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@nightly
with:
target: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
- name: Install trunk
run: |
wget -qO- https://github.com/thedodd/trunk/releases/download/v0.16.0/trunk-x86_64-unknown-linux-gnu.tar.gz | tar -xzf-
mv trunk /usr/local/bin/
- name: Run build
run: trunk build --release
- name: Archive dist directory
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
- name: Archive static directory
uses: actions/upload-artifact@v3
with:
name: static
path: static
test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@nightly
with:
target: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
- name: Run tests
run: cargo test --all-features --workspace
rustfmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@nightly
with:
target: wasm32-unknown-unknown
components: rustfmt
- uses: Swatinem/rust-cache@v2
- name: Check formatting
run: cargo fmt --all --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@nightly
with:
target: wasm32-unknown-unknown
components: clippy
- uses: Swatinem/rust-cache@v2
- name: Clippy check
run: cargo clippy --all-targets --all-features --workspace -- -D warnings
deploy:
name: Deploy to S3
# only runs when the branch is main
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: [build, test, rustfmt, clippy]
steps:
- name: Download dist artifact
uses: actions/[email protected]
with:
name: dist
path: dist
- name: Download static artifact
uses: actions/[email protected]
with:
name: static
path: static
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.IAM_DEPLOYER_ROLE }}
role-session-name: github_federated_aws
aws-region: ${{ vars.AWS_REGION }}
- name: Deploy Site to S3
env:
AWS_CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }}
AWS_S3_BUCKET : ${{ secrets.AWS_S3_BUCKET }}
run: |
aws s3 sync --delete --sse AES256 --acl public-read dist/ $AWS_S3_BUCKET
aws cloudfront create-invalidation --distribution-id "$AWS_CLOUDFRONT_DISTRIBUTION_ID" --paths "/*"
- name: Deploy static content to s3
env:
AWS_S3_BUCKET : ${{ secrets.AWS_S3_BUCKET }}
run: |
aws s3 sync --delete --sse AES256 --acl public-read static/ "$AWS_S3_BUCKET"static