Skip to content

Commit 652d066

Browse files
committed
style: standardize formatting in release workflow YAML
1 parent 41e5046 commit 652d066

File tree

1 file changed

+63
-69
lines changed

1 file changed

+63
-69
lines changed

.github/workflows/release-workflow.yml

Lines changed: 63 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ on:
44
workflow_dispatch:
55
inputs:
66
release_type:
7-
description: 'Release type'
7+
description: "Release type"
88
required: true
9-
default: 'patch'
9+
default: "patch"
1010
type: choice
1111
options:
12-
- patch
13-
- minor
14-
- major
12+
- patch
13+
- minor
14+
- major
1515

1616
permissions:
1717
contents: write
@@ -20,77 +20,71 @@ permissions:
2020
jobs:
2121
release:
2222
runs-on: ubuntu-latest
23-
24-
steps:
25-
- name: Checkout
26-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
27-
with:
28-
fetch-depth: 0
29-
token: ${{ secrets.GITHUB_TOKEN }}
30-
31-
- name: Setup Node.js
32-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
33-
with:
34-
node-version: '20'
3523

36-
- name: Install semver CLI
37-
run: npm install -g semver
38-
39-
- name: Get current version
40-
id: current_version
41-
run: |
42-
CURRENT_VERSION=$(grep '^version = ' Cargo.toml | sed 's/version = "\(.*\)"/\1/')
43-
echo "current=$CURRENT_VERSION" >> $GITHUB_OUTPUT
44-
echo "Current version: $CURRENT_VERSION"
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
27+
with:
28+
fetch-depth: 0
29+
token: ${{ secrets.GITHUB_TOKEN }}
4530

46-
- name: Set release type
47-
id: release_type
48-
run: |
49-
RELEASE_TYPE="${{ github.event.inputs.release_type }}"
50-
echo "type=$RELEASE_TYPE" >> $GITHUB_OUTPUT
51-
echo "Release type: $RELEASE_TYPE"
31+
- name: Setup Node.js
32+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
33+
with:
34+
node-version: "20"
5235

53-
- name: Calculate new version
54-
id: new_version
55-
run: |
56-
CURRENT_VERSION="${{ steps.current_version.outputs.current }}"
57-
RELEASE_TYPE="${{ steps.release_type.outputs.type }}"
58-
NEW_VERSION=$(semver -i $RELEASE_TYPE $CURRENT_VERSION)
59-
60-
echo "new=$NEW_VERSION" >> $GITHUB_OUTPUT
61-
echo "New version: $NEW_VERSION"
36+
- name: Install semver CLI
37+
run: npm install -g semver
6238

63-
- name: Update Cargo.toml
64-
run: |
65-
NEW_VERSION="${{ steps.new_version.outputs.new }}"
66-
sed -i "s/^version = \".*\"/version = \"$NEW_VERSION\"/" Cargo.toml
67-
echo "Updated Cargo.toml to version $NEW_VERSION"
39+
- name: Get current version
40+
id: current_version
41+
run: |
42+
CURRENT_VERSION=$(grep '^version = ' Cargo.toml | sed 's/version = "\(.*\)"/\1/')
43+
echo "current=$CURRENT_VERSION" >> $GITHUB_OUTPUT
44+
echo "Current version: $CURRENT_VERSION"
6845
46+
- name: Set release type
47+
id: release_type
48+
run: |
49+
RELEASE_TYPE="${{ github.event.inputs.release_type }}"
50+
echo "type=$RELEASE_TYPE" >> $GITHUB_OUTPUT
51+
echo "Release type: $RELEASE_TYPE"
6952
70-
- name: Commit version bump
71-
run: |
72-
NEW_VERSION="${{ steps.new_version.outputs.new }}"
73-
git config --local user.email "action@github.com"
74-
git config --local user.name "GitHub Action"
75-
git add Cargo.toml
76-
git commit -m "chore: release v$NEW_VERSION
53+
- name: Calculate new version
54+
id: new_version
55+
run: |
56+
CURRENT_VERSION="${{ steps.current_version.outputs.current }}"
57+
RELEASE_TYPE="${{ steps.release_type.outputs.type }}"
58+
NEW_VERSION=$(semver -i $RELEASE_TYPE $CURRENT_VERSION)
7759
78-
🤖 Generated with [Claude Code](https://claude.ai/code)
60+
echo "new=$NEW_VERSION" >> $GITHUB_OUTPUT
61+
echo "New version: $NEW_VERSION"
7962
80-
Co-Authored-By: Claude <noreply@anthropic.com>"
63+
- name: Update Cargo.toml
64+
run: |
65+
NEW_VERSION="${{ steps.new_version.outputs.new }}"
66+
sed -i "s/^version = \".*\"/version = \"$NEW_VERSION\"/" Cargo.toml
67+
echo "Updated Cargo.toml to version $NEW_VERSION"
8168
82-
- name: Create and push tag
83-
run: |
84-
NEW_VERSION="${{ steps.new_version.outputs.new }}"
85-
git tag -a "v$NEW_VERSION" -m "Release v$NEW_VERSION"
86-
git push origin main
87-
git push origin "v$NEW_VERSION"
69+
- name: Commit version bump
70+
run: |
71+
NEW_VERSION="${{ steps.new_version.outputs.new }}"
72+
git config --local user.email "action@github.com"
73+
git config --local user.name "GitHub Action"
74+
git add Cargo.toml
75+
git commit -m "chore: release v$NEW_VERSION"
76+
- name: Create and push tag
77+
run: |
78+
NEW_VERSION="${{ steps.new_version.outputs.new }}"
79+
git tag -a "v$NEW_VERSION" -m "Release v$NEW_VERSION"
80+
git push origin main
81+
git push origin "v$NEW_VERSION"
8882
89-
- name: Trigger Homebrew update
90-
run: |
91-
NEW_VERSION="${{ steps.new_version.outputs.new }}"
92-
# Wait a moment for the release workflow to complete
93-
sleep 60
94-
gh workflow run "Update Homebrew Formula" --field tag="v$NEW_VERSION"
95-
env:
96-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83+
- name: Trigger Homebrew update
84+
run: |
85+
NEW_VERSION="${{ steps.new_version.outputs.new }}"
86+
# Wait a moment for the release workflow to complete
87+
sleep 60
88+
gh workflow run "Update Homebrew Formula" --field tag="v$NEW_VERSION"
89+
env:
90+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)