1616 required : false
1717 type : string
1818 default : ubuntu-24.04
19+ nightly :
20+ required : false
21+ type : string
22+ default : false
1923
2024env :
2125 # renovate: datasource=github-releases depName=goreleaser/goreleaser-pro
22- GORELEASER_PRO_VERSION : v2.11.0
26+ GORELEASER_PRO_VERSION : v2.11.1
2327
2428jobs :
2529 prepare :
30+ outputs :
31+ PREVIOUS_RELEASE_TAG : ${{ steps.prev-tag.outputs.PREVIOUS_RELEASE_TAG }}
2632 strategy :
2733 matrix :
2834 GOOS : ${{ fromJSON(inputs.goos) }}
7278 go-version : " ~1.24"
7379 check-latest : true
7480
81+ - name : Set goreleaser last tag reference in case of non-nightly release
82+ id : prev-tag
83+ if : inputs.nightly != 'true'
84+ # find previous tag by filtering out nightly tags and binary release (OCB, OpAMP) tags and then choosing the
85+ # second to last tag (last one is the current release)
86+ run : |
87+ prev_tag=$(git tag | grep -v "cmd" | grep -v "nightly" | sort -r --version-sort | head -n 2 | tail -n 1)
88+ echo "PREVIOUS_RELEASE_TAG=$prev_tag" >> "$GITHUB_OUTPUT"
89+
90+ - name : Set nightly enabled
91+ id : nightly-check
92+ if : inputs.nightly == 'true'
93+ run : |
94+ echo "NIGHTLY_FLAG=--nightly" >> "$GITHUB_OUTPUT"
95+
7596 - name : Generate distribution sources
7697 run : make generate-sources
98+ env :
99+ DISTRIBUTIONS : ${{ inputs.distribution }}
77100
78101 - name : Log into Docker.io
79102 uses : docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
@@ -101,7 +124,7 @@ jobs:
101124 distribution : goreleaser-pro
102125 version : ${{ env.GORELEASER_PRO_VERSION }}
103126 workdir : distributions/${{ inputs.distribution }}
104- args : release --clean --split --timeout 2h --config .goreleaser-build.yaml --release-header-tmpl=../../.github/release-template.md
127+ args : release --clean --split --timeout 2h --config .goreleaser-build.yaml --release-header-tmpl=../../.github/release-template.md ${{ steps.nightly-check.outputs.NIGHTLY_FLAG }}
105128 env :
106129 GOOS : ${{ matrix.GOOS }}
107130 GOARCH : ${{ matrix.GOARCH }}
@@ -111,6 +134,7 @@ jobs:
111134 GORELEASER_KEY : ${{ secrets.GORELEASER_KEY }}
112135 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
113136 COSIGN_YES : true
137+ GORELEASER_CURRENT_TAG : ${{ github.ref_name }}
114138
115139 - name : Move built artifacts
116140 if : inputs.distribution == 'otelcol-contrib'
@@ -127,7 +151,7 @@ jobs:
127151 distribution : goreleaser-pro
128152 version : ${{ env.GORELEASER_PRO_VERSION }}
129153 workdir : distributions/${{ inputs.distribution }}
130- args : release --clean --split --timeout 2h --release-header-tmpl=../../.github/release-template.md
154+ args : release --clean --split --timeout 2h --release-header-tmpl=../../.github/release-template.md ${{ steps.nightly-check.outputs.NIGHTLY_FLAG }}
131155 env :
132156 GOOS : ${{ matrix.GOOS }}
133157 GOARCH : ${{ matrix.GOARCH }}
@@ -143,7 +167,7 @@ jobs:
143167 if-no-files-found : error
144168
145169 release :
146- name : ${{ inputs.distribution }} Release
170+ name : Release
147171 runs-on : ${{ inputs.runner_os }}
148172 needs : prepare
149173
@@ -232,3 +256,38 @@ jobs:
232256 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
233257 COSIGN_YES : true
234258 GORELEASER_KEY : ${{ secrets.GORELEASER_KEY }}
259+ GORELEASER_PREVIOUS_TAG : ${{ needs.prepare.outputs.PREVIOUS_RELEASE_TAG }}
260+ GORELEASER_CURRENT_TAG : ${{ github.ref_name }}
261+
262+ create-issue :
263+ name : Create GitHub issue on failed nightly release
264+ runs-on : ubuntu-latest
265+ needs : [release]
266+ if : failure() && inputs.nightly == 'true'
267+ permissions :
268+ issues : write
269+ env :
270+ issue-file : " nightly-release-failure.md"
271+ steps :
272+ - name : Formulate issue
273+ run : |
274+ # create a markdown file that contains details about the failure
275+ echo "---" > ${{ env.issue-file }}
276+ echo "title: Nightly Release Failed" >> ${{ env.issue-file }}
277+ echo "labels: release:blocker" >> ${{ env.issue-file }}
278+ echo "---" >> ${{ env.issue-file }}
279+ echo "The nightly release failed in the following GitHub actions run." >> ${{ env.issue-file }}
280+ echo "* Link to run: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> ${{ env.issue-file }}
281+ echo "* Please also check the other distro release runs related to this nightly release" >> ${{ env.issue-file }}
282+ echo "* Triggered by: Nightly scheduled release" >> ${{ env.issue-file }}
283+ echo "" >> ${{ env.issue-file }}
284+ echo "Note: This issue was auto-generated from [base-release.yaml](https://github.com/open-telemetry/opentelemetry-collector-releases/blob/main/.github/workflows/base-release.yaml)" >> ${{ env.issue-file }}
285+
286+ - name : Create or update issue
287+ uses : JasonEtco/create-an-issue@1b14a70e4d8dc185e5cc76d3bec9eab20257b2c5 # v2.9.2
288+ env :
289+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
290+ with :
291+ update_existing : true
292+ search_existing : open
293+ filename : ${{ env.issue-file }}
0 commit comments