From 4eb744bba3a98d354877c24b97407c08fa51dedd Mon Sep 17 00:00:00 2001 From: Rigidity Date: Mon, 15 Apr 2024 18:51:14 -0400 Subject: [PATCH] Add deployment CI workflow --- .github/workflows/deploy-pages.yml | 66 ++++++++++++++++++++++++++++++ .github/workflows/rust.yml | 8 ++-- 2 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/deploy-pages.yml diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml new file mode 100644 index 0000000..5942ec9 --- /dev/null +++ b/.github/workflows/deploy-pages.yml @@ -0,0 +1,66 @@ +name: Publish to GitHub pages + +on: + push: + branches: [main] + workflow_dispatch: + +permissions: + contents: write + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + Github-Pages-Release: + timeout-minutes: 10 + + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Rust + uses: dtolnay/rust-toolchain@stable + with: + components: clippy, rustfmt + + - name: Add WASM target + run: rustup target add wasm32-unknown-unknown + + - name: Clippy + run: cargo clippy -p rue-web + + - name: Fmt + run: cargo fmt -- --files-with-diff --check -p rue-web + + - name: Install Trunk binary + run: cargo binstall trunk + + - name: Build with Trunk + run: | + cd crates/rue-web + trunk build --release --public-url "${GITHUB_REPOSITORY#*/}" + + - name: Setup GitHub Pages + uses: actions/configure-pages@v4 + with: + enablement: true + token: + + - name: Upload artifact + uses: actions/upload-pages-artifact@v2 + with: + path: "./crates/rue-web/dist" + + - name: Deploy to GitHub Pages 🚀 + id: deployment + uses: actions/deploy-pages@v3 diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 13d342f..4b1cb10 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,4 +1,4 @@ -name: Rust +name: Build and test Rust code on: push: branches: @@ -23,10 +23,10 @@ jobs: components: clippy, rustfmt - name: Run tests - run: cargo test --all-features + run: cargo test --all-features --workspace - name: Clippy - run: cargo clippy + run: cargo clippy --workspace - name: Fmt - run: cargo fmt -- --files-with-diff --check + run: cargo fmt --workspace -- --files-with-diff --check