|
11 | 11 | required: false |
12 | 12 | default: false |
13 | 13 | type: boolean |
| 14 | + goreleaser_args: |
| 15 | + description: 'Additional GoReleaser args' |
| 16 | + required: false |
| 17 | + default: '' |
| 18 | + type: string |
| 19 | + skip_jobs: |
| 20 | + description: 'Comma-separated list of jobs to skip (e.g. tag,build-docker,generate-assertion-doc)' |
| 21 | + required: false |
| 22 | + default: '' |
| 23 | + type: string |
14 | 24 |
|
15 | 25 | env: |
16 | 26 | DOCKER_PLATFORMS: "linux/arm/v5,linux/arm/v6,linux/arm/v7,linux/arm64,linux/amd64,linux/ppc64le,linux/s390x,linux/mips64le,linux/386,linux/riscv64" |
|
41 | 51 | id: vars |
42 | 52 | run: echo "tag=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT |
43 | 53 |
|
| 54 | + tag: |
| 55 | + if: ${{ !contains(inputs.skip_jobs, 'tag') }} |
| 56 | + name: Create Tag for release |
| 57 | + runs-on: ubuntu-24.04 |
| 58 | + needs: [variables] |
| 59 | + permissions: |
| 60 | + contents: write |
| 61 | + steps: |
| 62 | + - name: Checkout Repository |
| 63 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 64 | + with: |
| 65 | + fetch-depth: 0 |
| 66 | + |
| 67 | + - name: Create new release Tag |
| 68 | + run: | |
| 69 | + git config --global user.email "[email protected]" |
| 70 | + git config --global user.name "NGINX Kubernetes Team" |
| 71 | + tag="v${{ needs.variables.outputs.tag }}" |
| 72 | + if ! git rev-parse --verify refs/tags/${tag} 2>/dev/null; then |
| 73 | + echo "Adding tag ${tag}." |
| 74 | + git tag -a ${tag} -m "Version ${tag#v*}" |
| 75 | + echo "Pushing tag ${tag} to main branch" |
| 76 | + if ! ${{ inputs.dry_run }}; then |
| 77 | + git push origin "${tag}" |
| 78 | + else |
| 79 | + echo "DRY RUN not making any changes" |
| 80 | + git push --dry-run origin "${tag}" |
| 81 | + fi |
| 82 | + else |
| 83 | + echo "Warning: Tag ${tag} already exists. Not making any changes" |
| 84 | + fi |
| 85 | + env: |
| 86 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 87 | + |
44 | 88 | build-docker: |
| 89 | + if: ${{ !contains(inputs.skip_jobs, 'build-docker') }} |
45 | 90 | name: Build Docker Image |
46 | 91 | runs-on: ubuntu-24.04-amd64 |
47 | 92 | permissions: |
|
54 | 99 | GOPROXY: ${{ secrets.ARTIFACTORY_ENDPOINT }} |
55 | 100 | outputs: |
56 | 101 | binaries: ${{ steps.prom_binaries.outputs.json }} |
| 102 | + needs: [variables] |
57 | 103 | services: |
58 | 104 | registry: |
59 | 105 | image: registry:3 |
@@ -130,7 +176,7 @@ jobs: |
130 | 176 | name=quay.io/nginx/nginx-prometheus-exporter,enable=true |
131 | 177 | name=localhost:5000/nginx/nginx-prometheus-exporter |
132 | 178 | tags: | |
133 | | - type=raw,value=${{ github.event.inputs.version }} |
| 179 | + type=raw,value=${{ needs.variables.outputs.tag }} |
134 | 180 | labels: | |
135 | 181 | org.opencontainers.image.vendor=NGINX Inc <[email protected]> |
136 | 182 | env: |
@@ -170,7 +216,7 @@ jobs: |
170 | 216 | uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0 |
171 | 217 | with: |
172 | 218 | version: v2.12.5 # renovate: datasource=github-tags depName=goreleaser/goreleaser |
173 | | - args: ${{ github.event.inputs.dry_run && 'build --snapshot' || 'release' }} --clean |
| 219 | + args: ${{ github.event.inputs.dry_run && 'build --snapshot' || 'release' }} --clean ${{ github.event.inputs.goreleaser_args }} |
174 | 220 | env: |
175 | 221 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
176 | 222 | NGINX_GITHUB_TOKEN: ${{ secrets.NGINX_PAT }} |
@@ -225,7 +271,7 @@ jobs: |
225 | 271 | sarif_file: ${{ steps.scan.outputs.sarif }} |
226 | 272 |
|
227 | 273 | generate-assertion-doc: |
228 | | - if: ${{ github.event_name != 'pull_request' }} |
| 274 | + if: ${{ !contains(inputs.skip_jobs, 'generate-assertion-doc') }} |
229 | 275 | name: Assertion Doc ${{ matrix.prometheus.arch }} |
230 | 276 | needs: [build-docker, variables] |
231 | 277 | runs-on: ubuntu-24.04-amd64 |
@@ -271,7 +317,7 @@ jobs: |
271 | 317 | - name: List packages in Go binary |
272 | 318 | id: godeps |
273 | 319 | env: |
274 | | - GOPROXY: ${{ needs.variables.outputs.go_proxy }} |
| 320 | + GOPROXY: ${{ secrets.ARTIFACTORY_ENDPOINT }} |
275 | 321 | run: | |
276 | 322 | go version -m ${{ matrix.prometheus.path }} > go_version_out_${{ github.run_id }}_${{ github.run_number }}.txt |
277 | 323 | echo "go_version_out=$(find -type f -name "go_version_out*.txt" | head -n 1)" >> $GITHUB_OUTPUT |
|
0 commit comments