diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 354e3a7..fdf9163 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,57 +10,8 @@ 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 - target: wasm32-unknown-unknown - - - 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 --locked - - - name: Check dependencies - run: cargo deny check - - - name: Check unused dependencies - run: cargo machete - - - 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 - target: wasm32-unknown-unknown - - - name: Test - run: cargo test --all-features --locked --release + rust: + name: Rust + uses: RustForWeb/.github/.github/workflows/rust.yml@373c25f8fd29e10c40f1343f13312f8be3514af0 + with: + target: wasm32-unknown-unknown diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..5883fc0 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,16 @@ +name: Publish + +on: + release: + types: [published] + +permissions: + contents: read + id-token: write + +jobs: + publish: + name: Publish + uses: RustForWeb/.github/.github/workflows/publish.yml@373c25f8fd29e10c40f1343f13312f8be3514af0 + with: + target: wasm32-unknown-unknown diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..fd39346 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,24 @@ +name: Release + +on: + workflow_dispatch: + inputs: + bump: + description: 'Bump version by semver keyword.' + required: true + type: choice + options: + - patch + - minor + - major + +permissions: + contents: write + +jobs: + release: + name: Release + uses: RustForWeb/.github/.github/workflows/release.yml@373c25f8fd29e10c40f1343f13312f8be3514af0 + with: + bump: ${{ inputs.bump }} + target: wasm32-unknown-unknown diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index d35ae85..0f5ca1e 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -1,103 +1,21 @@ name: Website + on: pull_request: {} push: branches: - main +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 - with: - target: wasm32-unknown-unknown - - - name: Install Cargo Binary Install - uses: cargo-bins/cargo-binstall@main - - - name: Install mdBook - run: cargo binstall --force -y mdbook mdbook-tabs mdbook-trunk - - - name: Run tests - run: mdbook test - 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 - with: - target: wasm32-unknown-unknown - - - name: Install Cargo Binary Install - uses: cargo-bins/cargo-binstall@main - - - name: Install mdBook and Trunk - run: cargo binstall --force -y mdbook mdbook-tabs mdbook-trunk trunk - - - name: Install Node.js dependencies - run: npm ci - - - name: Build Book - run: mdbook build - working-directory: book - - - name: Combine Book Outputs - run: mdbook-trunk combine - working-directory: book - - - name: Upload artifact - uses: actions/upload-artifact@v7 - with: - name: book - path: book/dist - 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@373c25f8fd29e10c40f1343f13312f8be3514af0