Skip to content

Commit d918508

Browse files
committed
chore: update gh actions
1 parent 9c25c8f commit d918508

File tree

10 files changed

+157
-479
lines changed

10 files changed

+157
-479
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/cd.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Continuous Delivery
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
type: choice
8+
required: true
9+
description: 'Version number to bump'
10+
options:
11+
- patch
12+
- minor
13+
- major
14+
pull_request:
15+
branches:
16+
- main
17+
types:
18+
- closed
19+
20+
permissions:
21+
contents: write
22+
issues: write
23+
pull-requests: write
24+
25+
jobs:
26+
publish-dry-run:
27+
name: "Runs cargo publish --dry-run"
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v6
32+
33+
- name: Setup Rust
34+
uses: dtolnay/rust-toolchain@stable
35+
36+
- name: Setup Rust Cache
37+
uses: Swatinem/rust-cache@v2
38+
39+
- name: Setup Cargo Binstall
40+
uses: cargo-bins/cargo-binstall@main
41+
42+
- name: Install Rust Binaries
43+
run: cargo binstall -y --force cargo-tag
44+
45+
- name: Build (debug)
46+
run: cargo b
47+
48+
- name: publish crate
49+
run: |
50+
cargo package --list --allow-dirty
51+
cargo publish --dry-run --allow-dirty
52+
53+
release:
54+
name: Create Release
55+
needs: build-binaries
56+
runs-on: ubuntu-latest
57+
steps:
58+
- name: Checkout
59+
uses: actions/checkout@v6
60+
61+
- name: Setup Rust
62+
uses: dtolnay/rust-toolchain@stable
63+
64+
- name: Setup Rust Cache
65+
uses: Swatinem/rust-cache@v2
66+
67+
- name: Setup Cargo Binstall
68+
uses: cargo-bins/cargo-binstall@main
69+
70+
- name: Install Rust Binaries
71+
run: cargo binstall -y --force cargo-tag
72+
73+
- name: Retrieve Git Commit SHA
74+
run: echo "GIT_COMMIT_SHA7=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV
75+
76+
- name: Commit Version Bump
77+
run: |
78+
git config --global user.name 'github-actions[bot]'
79+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
80+
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
81+
echo "CRATE_VERSION=$(cargo tag -p=v ${{ inputs.version }})" >> $GITHUB_ENV
82+
else
83+
echo "CRATE_VERSION=$(cargo tag -p=v prerelease pre.$GIT_COMMIT_SHA7)" >> $GITHUB_ENV
84+
fi
85+
git push origin main --follow-tags
86+
87+
- name: Login to Crates.io
88+
run: cargo login ${CRATES_IO_TOKEN}
89+
env:
90+
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
91+
92+
- name: Publish crate
93+
run: |
94+
cargo package --list --allow-dirty
95+
cargo publish --allow-dirty
96+
97+
- name: Download all artifacts
98+
uses: actions/download-artifact@v4
99+
with:
100+
path: ./artifacts
101+
102+
- name: Create Release with GitHub CLI
103+
env:
104+
GH_TOKEN: ${{ github.token }}
105+
run: |
106+
# Determine if this is a pre-release
107+
IS_PRERELEASE=""
108+
if [ "${{ github.event_name }}" != "workflow_dispatch" ]; then
109+
IS_PRERELEASE="--prerelease"
110+
fi
111+
112+
# Create the release
113+
gh release create "${{ env.CRATE_VERSION }}" \
114+
--title "${{ env.CRATE_VERSION }}" \
115+
--generate-notes \
116+
$IS_PRERELEASE

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: build
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v6
15+
16+
- name: Setup Rust
17+
uses: dtolnay/rust-toolchain@stable
18+
19+
- name: Setup Rust Cache
20+
uses: Swatinem/rust-cache@v2
21+
22+
- name: Build
23+
run: cargo b
24+
25+
- name: Run Formatter Check
26+
run: cargo fmt -- --check
27+
28+
- name: Run Clippy Check
29+
run: cargo clippy -- -D warnings
30+
31+
- name: Run Tests
32+
run: cargo test

.github/workflows/clippy.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

.github/workflows/dependabot-auto-approve.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/dependabot-auto-merge.yml renamed to .github/workflows/dependabot.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Dependabot auto-merge
1+
name: Dependabot Automation
22
on: pull_request_target
33

44
permissions:
@@ -15,9 +15,16 @@ jobs:
1515
uses: dependabot/fetch-metadata@v1.1.1
1616
with:
1717
github-token: "${{ secrets.GITHUB_TOKEN }}"
18+
19+
- name: Approve a PR
20+
run: gh pr review --approve "$PR_URL"
21+
env:
22+
PR_URL: ${{github.event.pull_request.html_url}}
23+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
24+
1825
- name: Enable auto-merge for Dependabot PRs
1926
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
20-
run: gh pr merge --auto --merge "$PR_URL"
27+
run: gh pr merge --auto --squash "$PR_URL"
2128
env:
2229
PR_URL: ${{github.event.pull_request.html_url}}
2330
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/fmt.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)