From a96a758d64ebcebdeb599a78605c9e815bed6cbb Mon Sep 17 00:00:00 2001 From: Ruairidh James Date: Thu, 4 Jun 2026 13:50:25 +0100 Subject: [PATCH 1/2] DS-5672: Add release workflow with GitHub publish --- .github/workflows/release.yml | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..f4b120b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,41 @@ +name: Release + +on: + push: + tags: + - v0.* + + +permissions: + contents: write + +jobs: + release: + name: Build and publish release artifacts + runs-on: ubuntu-latest + + steps: + - name: Check out repository + uses: actions/checkout@v5 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version-file: go.mod + cache: true + + - name: Test + run: go test ./... + + - name: Run GoReleaser + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + docker run --rm \ + -v "${PWD}:/workspace" \ + -w /workspace \ + -e GITHUB_TOKEN \ + ghcr.io/goreleaser/goreleaser-cross:v1.25-v2.12.7 \ + release --clean --parallelism 4 From 52b98434b2aeb06c0919db0e095b083f1711d207 Mon Sep 17 00:00:00 2001 From: Ruairidh James Date: Thu, 4 Jun 2026 16:19:58 +0100 Subject: [PATCH 2/2] DS-5672: Publish to GCS --- .github/workflows/release.yml | 8 ++++++++ .gitignore | 2 ++ .goreleaser.yml | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f4b120b..0ad05be 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,6 +29,9 @@ jobs: - name: Test run: go test ./... + - name: Set up GCP credentials + run: echo '${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}' > gcp-secret.json + - name: Run GoReleaser env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -37,5 +40,10 @@ jobs: -v "${PWD}:/workspace" \ -w /workspace \ -e GITHUB_TOKEN \ + -e GOOGLE_APPLICATION_CREDENTIALS=/workspace/gcp-secret.json \ ghcr.io/goreleaser/goreleaser-cross:v1.25-v2.12.7 \ release --clean --parallelism 4 + + - name: Clean up GCP credentials + if: always() + run: rm -f gcp-secret.json diff --git a/.gitignore b/.gitignore index 4c9fca0..7ca624f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ dist TODO* launch.json +apimetrics +gcp-secret.json diff --git a/.goreleaser.yml b/.goreleaser.yml index 21b5759..0f672f9 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -59,6 +59,11 @@ builds: - CC=x86_64-w64-mingw32-gcc - CXX=x86_64-w64-mingw32-g++ +blobs: + - provider: gs + bucket: apimetrics-cli + directory: "{{ .Version }}" + archives: - name_template: "{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}" format_overrides: