Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Upload Release Artifact | |
| on: | |
| release: | |
| types: [published] # triggers when a new release is published | |
| permissions: | |
| contents: write # required to upload assets to the release | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.23" | |
| - name: Build binary | |
| run: | | |
| mkdir -p dist | |
| go build -ldflags="-s -w" -o dist/prometheus_gitlabci_exporter . | |
| - name: Package binary | |
| run: | | |
| cd dist | |
| tar -czf prometheus_gitlabci_exporter-${{ github.event.release.tag_name }}.tar.gz prometheus_gitlabci_exporter | |
| ls -lh | |
| - name: Upload artifact to release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: dist/prometheus_gitlabci_exporter-${{ github.event.release.tag_name }}.tar.gz | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |