Skip to content

Use Oberve histogram method to properly populate histogram buckets (#… #5

Use Oberve histogram method to properly populate histogram buckets (#…

Use Oberve histogram method to properly populate histogram buckets (#… #5

name: Release on Tag Push
on:
push:
tags:
- v*
permissions:
contents: read
jobs:
tag-and-goreleaser:
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
persist-credentials: false
- name: Validate tag is semver
run: |
TAG="${GITHUB_REF#refs/tags/}"
if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::error::Tag '$TAG' is not a valid semver tag. This workflow only processes image release tags (e.g. v0.21.0). Helm chart tags (e.g. vcloudcost-exporter-1.2.0) are ignored."
exit 1
fi
echo "Tag '$TAG' is valid semver"
- name: Extract version
id: version
run: |
VERSION="${GITHUB_REF#refs/tags/}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Using pushed tag: $VERSION"
- name: Set up Go
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
with:
go-version: '1.25.0'
cache: false
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
with:
distribution: goreleaser
version: 2
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-and-export-digest:
needs: tag-and-goreleaser
permissions:
contents: read
id-token: write
outputs:
images: ${{ steps.build.outputs.images }}
strategy:
fail-fast: false
matrix:
include:
- runnerType: ubuntu-24.04-arm
platform: linux/arm64
- runnerType: ubuntu-24.04
platform: linux/amd64
runs-on: ${{ matrix.runnerType }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
ref: ${{ needs.tag-and-goreleaser.outputs.version }}
fetch-depth: 0
- name: Build and Push Image
id: build
uses: grafana/shared-workflows/actions/docker-build-push-image@ef27c620a88acc9f3007f30be5e9407324e8975b # docker-build-push-image/v0.3.0
with:
registries: dockerhub
platforms: ${{ matrix.platform }}
outputs: "type=image,push-by-digest=true,name-canonical=true,push=true"
push: true
tags: |
type=semver,pattern=v{{ version }}
include-tags-in-push: false
env:
version: ${{ needs.tag-and-goreleaser.outputs.version }}
- name: Export Docker Digest
id: export
uses: grafana/shared-workflows/actions/docker-export-digest@1d3e79a89e5fe2e14e27c7d083484f16abc1438b # docker-export-digest/v0.1.1
with:
digest: ${{ steps.build.outputs.digest }}
platform: ${{ matrix.platform }}
push-manifest:
needs: [tag-and-goreleaser, build-and-export-digest]
runs-on: ubuntu-24.04
permissions:
contents: read
id-token: write
steps:
- name: Download Multi-Arch Digests, Construct and Upload Manifest
uses: grafana/shared-workflows/actions/docker-import-digests-push-manifest@c7c3322b5815fd007586605e0ea286969f6aeae2 # docker-import-digests-push-manifest/v0.1.1
with:
images: ${{ needs.build-and-export-digest.outputs.images }}
push: true
tags: |
type=semver,pattern=v{{ version }}
env:
version: ${{ needs.tag-and-goreleaser.outputs.version }}
deploy:
needs: [tag-and-goreleaser, push-manifest]
runs-on: ubuntu-24.04
permissions:
contents: read
id-token: write
pull-requests: write
steps:
- name: Trigger Argo Workflow
uses: grafana/shared-workflows/actions/trigger-argo-workflow@e100806688f1209051080dfea5719fbbd1d18cc0 # trigger-argo-workflow/v1.2.1
with:
namespace: platform-monitoring-cd
workflow_template: cloudcost-exporter
parameters: |
imageName=grafana/cloudcost-exporter
dockertag=${{ needs.tag-and-goreleaser.outputs.version }}
prCommentContext= Triggered by release ${{ needs.tag-and-goreleaser.outputs.version }} in grafana/cloudcost-exporter
commit_author=grafana-delivery-bot