Skip to content

ci: add version flag #30

ci: add version flag

ci: add version flag #30

Workflow file for this run

name: Go
on: [push]
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux]
goarch: [amd64, arm64]
steps:
- uses: actions/checkout@v4
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
with:
short-length: 8 # Same as v3 and before
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: "1.23"
cache-dependency-path: go.sum
# You can test your matrix by printing the current Go version
- name: Display Go version
run: go version
- name: Install dependencies
run: go get .
- name: Build
run: |
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags="-X 'main.Version=${{ env.GITHUB_REF_SLUG }}'" -o turbostat-exporter-${{ matrix.goos }}-${{ matrix.goarch }}
chmod +x turbostat-exporter-${{ matrix.goos }}-${{ matrix.goarch }}
# - name: Archive binaries
# uses: actions/upload-artifact@v4
# with:
# name: turbostat-exporter-${{ matrix.goos }}-${{ matrix.goarch }}
# path: turbostat-exporter-${{ matrix.goos }}-${{ matrix.goarch }}
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
turbostat-exporter-*