Skip to content

Commit b46548c

Browse files
authored
chore: setup a node-reth release job (#133)
* chore: setup a node-reth release job * set release to draft
1 parent 73feafd commit b46548c

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

.github/workflows/release.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version_bump:
7+
description: 'Version bump type'
8+
required: true
9+
default: 'patch'
10+
type: choice
11+
options:
12+
- patch
13+
- minor
14+
- major
15+
16+
env:
17+
CARGO_TERM_COLOR: always
18+
19+
jobs:
20+
release:
21+
name: Create Release
22+
runs-on: ubuntu-latest
23+
permissions:
24+
contents: write
25+
steps:
26+
- name: Harden the runner (Audit all outbound calls)
27+
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
28+
with:
29+
egress-policy: audit
30+
31+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
32+
with:
33+
token: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- uses: dtolnay/rust-toolchain@4305c38b25d97ef35a8ad1f985ccf2d2242004f2 # stable
36+
37+
- name: Install cargo-edit
38+
run: cargo install cargo-edit
39+
40+
- name: Bump version
41+
run: |
42+
cargo set-version --bump ${{ inputs.version_bump }}
43+
NEW_VERSION=$(grep -m1 '^version = ' Cargo.toml | sed 's/version = "\(.*\)"/\1/')
44+
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
45+
echo "Bumped version to: $NEW_VERSION"
46+
47+
- name: Build project
48+
run: cargo build --all-targets
49+
50+
- name: Configure git
51+
run: |
52+
git config user.name "github-actions[bot]"
53+
git config user.email "github-actions[bot]@users.noreply.github.com"
54+
55+
- name: Commit and push changes
56+
run: |
57+
git add Cargo.toml Cargo.lock
58+
git commit -m "chore: bump version to ${{ env.NEW_VERSION }}"
59+
git tag -a "v${{ env.NEW_VERSION }}" -m "Release v${{ env.NEW_VERSION }}"
60+
git push origin main
61+
git push origin "v${{ env.NEW_VERSION }}"
62+
63+
- name: Create GitHub Release
64+
env:
65+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
run: |
67+
gh release create "v${{ env.NEW_VERSION }}" \
68+
--title "v${{ env.NEW_VERSION }}" \
69+
--generate-notes \
70+
--draft

0 commit comments

Comments
 (0)