Skip to content

Commit 6565fab

Browse files
ci: use reusable workflows (#18)
1 parent 4e6c7c3 commit 6565fab

7 files changed

Lines changed: 1550 additions & 147 deletions

File tree

.commitlintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": ["@commitlint/config-conventional"]
3+
}

.github/workflows/ci.yml

Lines changed: 14 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -10,55 +10,17 @@ 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
62-
63-
- name: Test
64-
run: cargo test --all-features --all-targets --locked --release
13+
commits:
14+
name: Commits
15+
uses: NixySoftware/.github/.github/workflows/commits.yml@473618d5365410901e83901c7d7066922a60ef4a # v0.3.1
16+
17+
rust:
18+
name: Rust
19+
uses: NixySoftware/.github/.github/workflows/rust.yml@473618d5365410901e83901c7d7066922a60ef4a # v0.3.1
20+
21+
typescript:
22+
name: TypeScript
23+
uses: NixySoftware/.github/.github/workflows/typescript.yml@473618d5365410901e83901c7d7066922a60ef4a # v0.3.1
24+
with:
25+
enable-lint: false
26+
enable-test: false

.github/workflows/publish.yml

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,14 @@ 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: NixySoftware/.github/.github/workflows/publish.yml@9704b92a2cefe90342562266d127a0c9dd132640 # v0.2.0
15+
with:
16+
enable-rust: true
17+
enable-typescript: false

.github/workflows/pull-request.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Pull Request
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, edited]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
pull-request:
12+
name: Pull Request
13+
uses: NixySoftware/.github/.github/workflows/commits.yml@9704b92a2cefe90342562266d127a0c9dd132640 # v0.2.0

.github/workflows/release.yml

Lines changed: 9 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -18,66 +18,12 @@ 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@v1
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@v8
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@v2
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: NixySoftware/.github/.github/workflows/release.yml@9704b92a2cefe90342562266d127a0c9dd132640 # v0.2.0
22+
with:
23+
bump: ${{ inputs.bump }}
24+
bump-rust: true
25+
bump-typescript: false
26+
extract-version: 'rust'
27+
secrets:
28+
app-client-id: ${{ secrets.APP_ID }}
29+
app-private-key: ${{ secrets.APP_PRIVATE_KEY }}

0 commit comments

Comments
 (0)