Skip to content

Commit f2c542f

Browse files
ci: use reusable workflows
1 parent aff4a15 commit f2c542f

4 files changed

Lines changed: 21 additions & 234 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -10,55 +10,6 @@ permissions:
1010
contents: read
1111

1212
jobs:
13-
lint:
14-
name: Lint
15-
runs-on: ubuntu-latest
16-
17-
env:
18-
RUSTFLAGS: '-Dwarnings'
19-
20-
steps:
21-
- name: Checkout
22-
uses: actions/checkout@v6
23-
24-
- name: Set up Rust toolchain
25-
uses: actions-rust-lang/setup-rust-toolchain@v1
26-
with:
27-
components: clippy, rustfmt
28-
29-
- name: Install Cargo Binary Install
30-
uses: cargo-bins/cargo-binstall@main
31-
32-
- name: Install crates
33-
run: cargo binstall -y --force cargo-deny cargo-machete cargo-sort
34-
35-
- name: Lint
36-
run: cargo clippy --all-features --all-targets --locked
37-
38-
- name: Check dependencies
39-
run: cargo deny check
40-
41-
- name: Check unused dependencies
42-
run: cargo machete --with-metadata
43-
44-
- name: Check manifest formatting
45-
run: cargo sort --workspace --check
46-
47-
- name: Check formatting
48-
run: cargo fmt --all --check
49-
50-
test:
51-
name: Test
52-
runs-on: ubuntu-latest
53-
54-
steps:
55-
- name: Checkout
56-
uses: actions/checkout@v6
57-
58-
- name: Set up Rust toolchain
59-
uses: actions-rust-lang/setup-rust-toolchain@v1
60-
with:
61-
components: clippy, rustfmt, rust-src
62-
63-
- name: Test
64-
run: cargo test --all-features --locked --release
13+
rust:
14+
name: Rust
15+
uses: RustForWeb/.github/.github/workflows/rust.yml@d6e6ead9b4da3d70245d3ee4e06fe339244bb200

.github/workflows/publish.yml

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,11 @@ on:
44
release:
55
types: [published]
66

7+
permissions:
8+
contents: read
9+
id-token: write
10+
711
jobs:
812
publish:
913
name: Publish
10-
runs-on: ubuntu-latest
11-
12-
permissions:
13-
contents: read
14-
id-token: write
15-
16-
steps:
17-
- name: Checkout
18-
uses: actions/checkout@v6
19-
20-
- name: Set up Rust toolchain
21-
uses: actions-rust-lang/setup-rust-toolchain@v1
22-
23-
- name: Install Cargo Binary Install
24-
uses: cargo-bins/cargo-binstall@main
25-
26-
- name: Install crates
27-
run: cargo binstall --force -y cargo-workspaces
28-
29-
- uses: rust-lang/crates-io-auth-action@v1
30-
id: auth
31-
32-
- name: Publish
33-
run: cargo workspaces publish --publish-as-is
34-
env:
35-
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
14+
uses: RustForWeb/.github/.github/workflows/publish.yml@d6e6ead9b4da3d70245d3ee4e06fe339244bb200

.github/workflows/release.yml

Lines changed: 3 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -18,66 +18,6 @@ permissions:
1818
jobs:
1919
release:
2020
name: Release
21-
runs-on: ubuntu-latest
22-
23-
steps:
24-
- name: Generate GitHub App token
25-
id: app-token
26-
uses: getsentry/action-github-app-token@v3
27-
with:
28-
app_id: ${{ secrets.APP_ID }}
29-
private_key: ${{ secrets.APP_PRIVATE_KEY }}
30-
31-
- name: Checkout
32-
uses: actions/checkout@v6
33-
34-
- name: Set up Rust toolchain
35-
uses: actions-rust-lang/setup-rust-toolchain@v1
36-
37-
- name: Install Cargo Binary Install
38-
uses: cargo-bins/cargo-binstall@main
39-
40-
- name: Install crates
41-
run: cargo binstall --force -y cargo-workspaces toml-cli
42-
43-
- name: Bump version
44-
run: cargo workspaces version --all --no-git-commit --yes ${{ inputs.bump }}
45-
46-
- name: Extract version
47-
id: extract-version
48-
run: echo "VERSION=v$(toml get Cargo.toml workspace.package.version --raw)" >> "$GITHUB_OUTPUT"
49-
50-
- name: Add changes
51-
run: git add .
52-
53-
- name: Commit
54-
id: commit
55-
uses: dsanders11/github-app-commit-action@v2
56-
with:
57-
message: ${{ steps.extract-version.outputs.VERSION }}
58-
token: ${{ steps.app-token.outputs.token }}
59-
60-
- name: Reset and pull
61-
run: git reset --hard && git pull
62-
63-
- name: Tag
64-
uses: actions/github-script@v9
65-
env:
66-
GIT_TAG: ${{ steps.extract-version.outputs.VERSION }}
67-
GIT_SHA: ${{ steps.commit.outputs.sha }}
68-
with:
69-
script: |
70-
github.rest.git.createRef({
71-
owner: context.repo.owner,
72-
repo: context.repo.repo,
73-
ref: `refs/tags/${process.env.GIT_TAG}`,
74-
sha: process.env.GIT_SHA
75-
})
76-
77-
- name: Release
78-
uses: softprops/action-gh-release@v3
79-
with:
80-
generate_release_notes: true
81-
make_latest: true
82-
tag_name: ${{ steps.extract-version.outputs.VERSION }}
83-
token: ${{ steps.app-token.outputs.token }}
21+
uses: RustForWeb/.github/.github/workflows/release.yml@d6e6ead9b4da3d70245d3ee4e06fe339244bb200
22+
with:
23+
bump: ${{ inputs.bump }}

.github/workflows/website.yml

Lines changed: 10 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: Website
2+
23
on:
34
pull_request: {}
45
push:
@@ -7,102 +8,18 @@ on:
78

89
permissions:
910
contents: read
11+
id-token: write
12+
pages: write
1013

1114
concurrency:
1215
group: ${{ github.workflow }}-${{ github.ref }}
1316
cancel-in-progress: false
1417

1518
jobs:
16-
book-test:
17-
name: Test Book
18-
runs-on: ubuntu-latest
19-
20-
steps:
21-
- uses: actions/checkout@v6
22-
23-
- name: Set up Rust toolchain
24-
uses: actions-rust-lang/setup-rust-toolchain@v1
25-
26-
- name: Install Cargo Binary Install
27-
uses: cargo-bins/cargo-binstall@main
28-
29-
- name: Install mdBook
30-
run: cargo binstall --force -y mdbook mdbook-tabs
31-
32-
- name: Clean dependencies
33-
run: cargo clean -p fortifier -p regex
34-
35-
- name: Build dependencies
36-
run: cargo build -p fortifier --features all-validations -p regex
37-
38-
- name: Run tests
39-
run: mdbook test -L ../target/debug/deps
40-
working-directory: book
41-
42-
book-build:
43-
name: Build Book
44-
needs: book-test
45-
runs-on: ubuntu-latest
46-
47-
steps:
48-
- uses: actions/checkout@v6
49-
with:
50-
fetch-depth: 0
51-
52-
- name: Set up Rust toolchain
53-
uses: actions-rust-lang/setup-rust-toolchain@v1
54-
55-
- name: Install Cargo Binary Install
56-
uses: cargo-bins/cargo-binstall@main
57-
58-
- name: Install mdBook
59-
run: cargo binstall --force -y mdbook mdbook-tabs
60-
61-
- name: Install Node.js dependencies
62-
run: npm install
63-
64-
- name: Build Book
65-
run: mdbook build
66-
working-directory: book
67-
68-
- name: Upload artifact
69-
uses: actions/upload-artifact@v7
70-
with:
71-
name: book
72-
path: book/book
73-
retention-days: 1
74-
if-no-files-found: error
75-
76-
deploy:
77-
name: Deploy
78-
needs: book-build
79-
if: github.ref == 'refs/heads/main'
80-
runs-on: ubuntu-latest
81-
82-
permissions:
83-
contents: read
84-
pages: write
85-
id-token: write
86-
87-
steps:
88-
- uses: actions/checkout@v6
89-
with:
90-
fetch-depth: 0
91-
92-
- name: Download artifacts
93-
uses: actions/download-artifact@v8
94-
with:
95-
path: dist
96-
merge-multiple: true
97-
98-
- name: Setup Pages
99-
uses: actions/configure-pages@v6
100-
101-
- name: Upload artifact
102-
uses: actions/upload-pages-artifact@v5
103-
with:
104-
path: dist
105-
106-
- name: Deploy to GitHub Pages
107-
id: deployment
108-
uses: actions/deploy-pages@v5
19+
book:
20+
name: Book
21+
uses: RustForWeb/.github/.github/workflows/book.yml@d6e6ead9b4da3d70245d3ee4e06fe339244bb200
22+
with:
23+
combine: false
24+
clean-options: '-p fortifier -p regex'
25+
build-options: '-p fortifier --features all-validations -p regex'

0 commit comments

Comments
 (0)