From f2c542fcf09f0d8725d8df938c7e708c7accbef5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABlle=20Huisman?= Date: Mon, 27 Apr 2026 16:23:47 +0200 Subject: [PATCH] ci: use reusable workflows --- .github/workflows/ci.yml | 55 +----------------- .github/workflows/publish.yml | 31 ++-------- .github/workflows/release.yml | 66 +--------------------- .github/workflows/website.yml | 103 ++++------------------------------ 4 files changed, 21 insertions(+), 234 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4ddcb2e..ec2ce85 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,55 +10,6 @@ permissions: contents: read jobs: - lint: - name: Lint - runs-on: ubuntu-latest - - env: - RUSTFLAGS: '-Dwarnings' - - steps: - - name: Checkout - uses: actions/checkout@v6 - - - name: Set up Rust toolchain - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - components: clippy, rustfmt - - - name: Install Cargo Binary Install - uses: cargo-bins/cargo-binstall@main - - - name: Install crates - run: cargo binstall -y --force cargo-deny cargo-machete cargo-sort - - - name: Lint - run: cargo clippy --all-features --all-targets --locked - - - name: Check dependencies - run: cargo deny check - - - name: Check unused dependencies - run: cargo machete --with-metadata - - - name: Check manifest formatting - run: cargo sort --workspace --check - - - name: Check formatting - run: cargo fmt --all --check - - test: - name: Test - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v6 - - - name: Set up Rust toolchain - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - components: clippy, rustfmt, rust-src - - - name: Test - run: cargo test --all-features --locked --release + rust: + name: Rust + uses: RustForWeb/.github/.github/workflows/rust.yml@d6e6ead9b4da3d70245d3ee4e06fe339244bb200 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index aa1f5da..f59320b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -4,32 +4,11 @@ on: release: types: [published] +permissions: + contents: read + id-token: write + jobs: publish: name: Publish - runs-on: ubuntu-latest - - permissions: - contents: read - id-token: write - - steps: - - name: Checkout - uses: actions/checkout@v6 - - - name: Set up Rust toolchain - uses: actions-rust-lang/setup-rust-toolchain@v1 - - - name: Install Cargo Binary Install - uses: cargo-bins/cargo-binstall@main - - - name: Install crates - run: cargo binstall --force -y cargo-workspaces - - - uses: rust-lang/crates-io-auth-action@v1 - id: auth - - - name: Publish - run: cargo workspaces publish --publish-as-is - env: - CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }} + uses: RustForWeb/.github/.github/workflows/publish.yml@d6e6ead9b4da3d70245d3ee4e06fe339244bb200 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c3824ae..056f15d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,66 +18,6 @@ permissions: jobs: release: name: Release - runs-on: ubuntu-latest - - steps: - - name: Generate GitHub App token - id: app-token - uses: getsentry/action-github-app-token@v3 - with: - app_id: ${{ secrets.APP_ID }} - private_key: ${{ secrets.APP_PRIVATE_KEY }} - - - name: Checkout - uses: actions/checkout@v6 - - - name: Set up Rust toolchain - uses: actions-rust-lang/setup-rust-toolchain@v1 - - - name: Install Cargo Binary Install - uses: cargo-bins/cargo-binstall@main - - - name: Install crates - run: cargo binstall --force -y cargo-workspaces toml-cli - - - name: Bump version - run: cargo workspaces version --all --no-git-commit --yes ${{ inputs.bump }} - - - name: Extract version - id: extract-version - run: echo "VERSION=v$(toml get Cargo.toml workspace.package.version --raw)" >> "$GITHUB_OUTPUT" - - - name: Add changes - run: git add . - - - name: Commit - id: commit - uses: dsanders11/github-app-commit-action@v2 - with: - message: ${{ steps.extract-version.outputs.VERSION }} - token: ${{ steps.app-token.outputs.token }} - - - name: Reset and pull - run: git reset --hard && git pull - - - name: Tag - uses: actions/github-script@v9 - env: - GIT_TAG: ${{ steps.extract-version.outputs.VERSION }} - GIT_SHA: ${{ steps.commit.outputs.sha }} - with: - script: | - github.rest.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: `refs/tags/${process.env.GIT_TAG}`, - sha: process.env.GIT_SHA - }) - - - name: Release - uses: softprops/action-gh-release@v3 - with: - generate_release_notes: true - make_latest: true - tag_name: ${{ steps.extract-version.outputs.VERSION }} - token: ${{ steps.app-token.outputs.token }} + uses: RustForWeb/.github/.github/workflows/release.yml@d6e6ead9b4da3d70245d3ee4e06fe339244bb200 + with: + bump: ${{ inputs.bump }} diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index 8eeaae4..22516fa 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -1,4 +1,5 @@ name: Website + on: pull_request: {} push: @@ -7,102 +8,18 @@ on: permissions: contents: read + id-token: write + pages: write concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: false jobs: - book-test: - name: Test Book - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v6 - - - name: Set up Rust toolchain - uses: actions-rust-lang/setup-rust-toolchain@v1 - - - name: Install Cargo Binary Install - uses: cargo-bins/cargo-binstall@main - - - name: Install mdBook - run: cargo binstall --force -y mdbook mdbook-tabs - - - name: Clean dependencies - run: cargo clean -p fortifier -p regex - - - name: Build dependencies - run: cargo build -p fortifier --features all-validations -p regex - - - name: Run tests - run: mdbook test -L ../target/debug/deps - working-directory: book - - book-build: - name: Build Book - needs: book-test - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Set up Rust toolchain - uses: actions-rust-lang/setup-rust-toolchain@v1 - - - name: Install Cargo Binary Install - uses: cargo-bins/cargo-binstall@main - - - name: Install mdBook - run: cargo binstall --force -y mdbook mdbook-tabs - - - name: Install Node.js dependencies - run: npm install - - - name: Build Book - run: mdbook build - working-directory: book - - - name: Upload artifact - uses: actions/upload-artifact@v7 - with: - name: book - path: book/book - retention-days: 1 - if-no-files-found: error - - deploy: - name: Deploy - needs: book-build - if: github.ref == 'refs/heads/main' - runs-on: ubuntu-latest - - permissions: - contents: read - pages: write - id-token: write - - steps: - - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Download artifacts - uses: actions/download-artifact@v8 - with: - path: dist - merge-multiple: true - - - name: Setup Pages - uses: actions/configure-pages@v6 - - - name: Upload artifact - uses: actions/upload-pages-artifact@v5 - with: - path: dist - - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v5 + book: + name: Book + uses: RustForWeb/.github/.github/workflows/book.yml@d6e6ead9b4da3d70245d3ee4e06fe339244bb200 + with: + combine: false + clean-options: '-p fortifier -p regex' + build-options: '-p fortifier --features all-validations -p regex'