Skip to content

Commit 6c2de56

Browse files
move computing the git tag into a separate Linux-only step (#1110)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 04f4d6f commit 6c2de56

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

.github/workflows/base-release.yaml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,24 @@ env:
2626
GORELEASER_PRO_VERSION: v2.11.2
2727

2828
jobs:
29-
prepare:
29+
prev-tag:
3030
outputs:
3131
PREVIOUS_RELEASE_TAG: ${{ steps.prev-tag.outputs.PREVIOUS_RELEASE_TAG }}
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
35+
with:
36+
fetch-depth: 0
37+
- name: Set goreleaser last tag reference in case of non-nightly release
38+
id: prev-tag
39+
if: inputs.nightly != 'true'
40+
# find previous tag by filtering out nightly tags and binary release (OCB, OpAMP) tags and then choosing the
41+
# second to last tag (last one is the current release)
42+
run: |
43+
prev_tag=$(git tag | grep -v "cmd" | grep -v "nightly" | sort -r --version-sort | head -n 2 | tail -n 1)
44+
echo "PREVIOUS_RELEASE_TAG=$prev_tag" >> "$GITHUB_OUTPUT"
45+
46+
prepare:
3247
strategy:
3348
matrix:
3449
GOOS: ${{ fromJSON(inputs.goos) }}
@@ -80,15 +95,6 @@ jobs:
8095
go-version: "~1.24"
8196
check-latest: true
8297

83-
- name: Set goreleaser last tag reference in case of non-nightly release
84-
id: prev-tag
85-
if: inputs.nightly != 'true'
86-
# find previous tag by filtering out nightly tags and binary release (OCB, OpAMP) tags and then choosing the
87-
# second to last tag (last one is the current release)
88-
run: |
89-
prev_tag=$(git tag | grep -v "cmd" | grep -v "nightly" | sort -r --version-sort | head -n 2 | tail -n 1)
90-
echo "PREVIOUS_RELEASE_TAG=$prev_tag" >> "$GITHUB_OUTPUT"
91-
9298
- name: Set nightly enabled
9399
id: nightly-check
94100
if: inputs.nightly == 'true'
@@ -258,7 +264,7 @@ jobs:
258264
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
259265
COSIGN_YES: true
260266
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
261-
GORELEASER_PREVIOUS_TAG: ${{ needs.prepare.outputs.PREVIOUS_RELEASE_TAG }}
267+
GORELEASER_PREVIOUS_TAG: ${{ needs.prev-tag.outputs.PREVIOUS_RELEASE_TAG }}
262268
GORELEASER_CURRENT_TAG: ${{ github.ref_name }}
263269

264270
create-issue:

0 commit comments

Comments
 (0)