diff --git a/.github/workflows/base-release.yaml b/.github/workflows/base-release.yaml index 2dd19086d..12289ebd8 100644 --- a/.github/workflows/base-release.yaml +++ b/.github/workflows/base-release.yaml @@ -26,9 +26,24 @@ env: GORELEASER_PRO_VERSION: v2.11.2 jobs: - prepare: + prev-tag: outputs: PREVIOUS_RELEASE_TAG: ${{ steps.prev-tag.outputs.PREVIOUS_RELEASE_TAG }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 + with: + fetch-depth: 0 + - name: Set goreleaser last tag reference in case of non-nightly release + id: prev-tag + if: inputs.nightly != 'true' + # find previous tag by filtering out nightly tags and binary release (OCB, OpAMP) tags and then choosing the + # second to last tag (last one is the current release) + run: | + prev_tag=$(git tag | grep -v "cmd" | grep -v "nightly" | sort -r --version-sort | head -n 2 | tail -n 1) + echo "PREVIOUS_RELEASE_TAG=$prev_tag" >> "$GITHUB_OUTPUT" + + prepare: strategy: matrix: GOOS: ${{ fromJSON(inputs.goos) }} @@ -80,15 +95,6 @@ jobs: go-version: "~1.24" check-latest: true - - name: Set goreleaser last tag reference in case of non-nightly release - id: prev-tag - if: inputs.nightly != 'true' - # find previous tag by filtering out nightly tags and binary release (OCB, OpAMP) tags and then choosing the - # second to last tag (last one is the current release) - run: | - prev_tag=$(git tag | grep -v "cmd" | grep -v "nightly" | sort -r --version-sort | head -n 2 | tail -n 1) - echo "PREVIOUS_RELEASE_TAG=$prev_tag" >> "$GITHUB_OUTPUT" - - name: Set nightly enabled id: nightly-check if: inputs.nightly == 'true' @@ -258,7 +264,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} COSIGN_YES: true GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} - GORELEASER_PREVIOUS_TAG: ${{ needs.prepare.outputs.PREVIOUS_RELEASE_TAG }} + GORELEASER_PREVIOUS_TAG: ${{ needs.prev-tag.outputs.PREVIOUS_RELEASE_TAG }} GORELEASER_CURRENT_TAG: ${{ github.ref_name }} create-issue: