Skip to content

Commit 648e725

Browse files
inject proposed version when running goreleaser
1 parent 0558e35 commit 648e725

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

Diff for: .github/workflows/release.yml

+18-11
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,35 @@ name: goreleaser
55

66
on:
77
workflow_dispatch:
8-
inputs:
9-
prerelease:
10-
description: If set, publish this as a release candidate / prerelease version.
11-
type: boolean
12-
required: true
138

149
jobs:
1510
release:
11+
permissions:
12+
contents: read
1613
runs-on: ubuntu-latest
1714
steps:
1815
- name: Checkout
1916
uses: actions/checkout@v4
20-
with:
21-
fetch-depth: 0
2217
- name: Set up Go
2318
uses: actions/setup-go@v5
2419
with:
25-
go-version: 1.20
20+
go-version: "1.20"
21+
- name: Extract version
22+
id: extract_version
23+
#env:
24+
# # Fake Git authorship information to try to make git tag happy.
25+
# GIT_AUTHOR_NAME: "go-jsonnet-releaser"
26+
# GIT_AUTHOR_EMAIL: "[email protected]"
27+
run: |
28+
CMD_VERSION="$(go run ./cmd/jsonnet --version | grep -oe 'v[0-9][0-9a-z.-]*$')" &&
29+
printf "Extracted jsonnet version: %s\n" "${CMD_VERSION}" &&
30+
git tag "${CMD_VERSION}" &&
31+
printf "jsonnet_version='%s'\n" "${CMD_VERSION}" >> "${GITHUB_OUTPUT}"
2632
- name: Run GoReleaser
2733
uses: goreleaser/goreleaser-action@90a3faa9d0182683851fbfa97ca1a2cb983bfca3 # v6.2.1
34+
env:
35+
PROPOSED_VERSION: "${{ steps.extract_version.outputs.jsonnet_version }}"
36+
GITHUB_TOKEN: "${{ github.token }}"
2837
with:
2938
version: latest
30-
args: release --rm-dist
31-
env:
32-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
args: release --clean

Diff for: .goreleaser.yml

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ checksum:
9696
release:
9797
draft: true
9898
skip_upload: false
99+
target_commitish: "{{ .Env.PROPOSED_VERSION }}"
99100

100101
nfpms:
101102
- id: jsonnet

0 commit comments

Comments
 (0)