Skip to content

Commit bb60c51

Browse files
committed
fix: patching release process
1 parent ee1f6f2 commit bb60c51

File tree

6 files changed

+64
-4
lines changed

6 files changed

+64
-4
lines changed

.github/workflows/release.yaml

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,37 @@ on:
1010
- trunk
1111

1212
jobs:
13+
get-version:
14+
runs-on: ubuntu-latest
15+
outputs:
16+
version: ${{ steps.get_version.outputs.version }}
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
persist-credentials: false
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: 'lts/*'
28+
- uses: pnpm/action-setup@v4
29+
- name: Install dependencies
30+
run: pnpm install
31+
32+
- name: Version
33+
id: get_version
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.PUSH }}
36+
run: pnpm run release --no-ci --dry-run
37+
38+
- name: Display
39+
run: echo "The next version is ${{ steps.get_version.outputs.version }}"
40+
1341
build-stamusctl:
42+
needs: [get-version]
43+
1444
runs-on: ${{ matrix.runner }}
1545
strategy:
1646
matrix:
@@ -24,14 +54,16 @@ jobs:
2454
with:
2555
go-version: ${{ matrix.go-version }}
2656
- name: Build
27-
run: make cli && mv dist/stamusctl dist/stamusctl-${{matrix.os}}-${{matrix.arch}}
57+
run: VERSION=${{ needs.get-version.outputs.version }} make cli && mv dist/stamusctl dist/stamusctl-${{matrix.os}}-${{matrix.arch}}
2858
- name: Upload
2959
uses: actions/upload-artifact@v4
3060
with:
3161
name: stamusctl-${{matrix.os}}-${{matrix.arch}}
3262
path: dist/*
3363

3464
build-stamusdaemon:
65+
needs: [get-version]
66+
3567
runs-on: ${{ matrix.runner }}
3668
strategy:
3769
matrix:
@@ -45,7 +77,7 @@ jobs:
4577
with:
4678
go-version: ${{ matrix.go-version }}
4779
- name: Build
48-
run: make daemon && mv dist/stamusd dist/stamusd-${{matrix.os}}-${{matrix.arch}}
80+
run: VERSION=${{ needs.get-version.outputs.version }} make daemon && mv dist/stamusd dist/stamusd-${{matrix.os}}-${{matrix.arch}}
4981
- name: Upload
5082
uses: actions/upload-artifact@v4
5183
with:

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ HOST_ARCH:=$(shell go env GOARCH)
1212

1313
TARGET_ARCH?=linux/amd64
1414

15-
VERSION=$(shell git describe --tags --abbrev=0)
15+
VERSION:=$(if $(VERSION),$(VERSION),$(shell git describe --tags --abbrev=0))
1616
GIT_COMMIT:=$(if $(GIT_COMMIT),$(GIT_COMMIT),$(shell git rev-parse HEAD))
1717

1818
GOPATH?=$(shell if test -x `which go`; then go env GOPATH; else echo "$(HOME)/go"; fi)

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
ldflags = [
2727
"-X stamus-ctl/internal/app.Arch=${system}"
2828
"-X stamus-ctl/internal/app.Commit=dev"
29-
"-X stamus-ctl/internal/app.Version=0.7.3"
29+
"-X stamus-ctl/internal/app.Version=unstable"
3030
"-X stamus-ctl/internal/logging.envType=prd"
3131
"-extldflags=-static"
3232
];

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"@commitlint/prompt-cli": "^19.8.0",
1515
"@semantic-release/changelog": "^6.0.3",
1616
"@semantic-release/commit-analyzer": "^13.0.1",
17+
"@semantic-release/exec": "^7.1.0",
1718
"@semantic-release/git": "^10.0.1",
1819
"@semantic-release/gitlab": "^13.2.4",
1920
"@semantic-release/release-notes-generator": "^14.0.3",

pnpm-lock.yaml

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

release.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ module.exports = {
5454
message: 'ci(release): release ${nextRelease.version}\n\n${nextRelease.notes}',
5555
},
5656
],
57+
[
58+
'@semantic-release/exec',
59+
{
60+
verifyReleaseCmd: 'echo "version=${nextRelease.version}" >> $GITHUB_OUTPUT',
61+
},
62+
],
5763
...(isGitLab ? [gitlab] : [github]), // Dynamically select GitLab or GitHub
5864
],
5965
}

0 commit comments

Comments
 (0)