forked from grafana/pyroscope
-
Notifications
You must be signed in to change notification settings - Fork 1
93 lines (90 loc) · 4.17 KB
/
release.yml
File metadata and controls
93 lines (90 loc) · 4.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: goreleaser
on:
push:
# run only against tags
tags:
- "v*"
permissions:
contents: write
packages: write
id-token: write
# issues: write
jobs:
goreleaser:
runs-on: ubuntu-x64-large
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
fetch-depth: 0
persist-credentials: 'false'
- name: Set GIT_LAST_COMMIT_DATE
run: echo "GIT_LAST_COMMIT_DATE=$(git log -1 --date=iso-strict --format=%cd)" >> $GITHUB_ENV
- name: Set IMAGE_TAG from git tag
run: echo "IMAGE_TAG=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
- name: Set IMAGE_PUBLISH_LATEST=true, so we overwrite the latest docker image tag and update Homebrew
run: echo "IMAGE_PUBLISH_LATEST=true" >> $GITHUB_ENV
# Forces goreleaser to use the correct previous tag for the changelog
- name: Set GORELEASER_PREVIOUS_TAG
run: echo "GORELEASER_PREVIOUS_TAG=$(git tag -l --sort=-version:refname | grep -E '^v.*' | head -n 2 | tail -1)" >> $GITHUB_ENV
- run: git fetch --force --tags
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
with:
go-version: "1.24.13"
cache: false
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 20
package-manager-cache: false
# setup docker buildx
- name: Set up QEMU
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
# login to docker hub
- id: get-secrets
uses: grafana/shared-workflows/actions/get-vault-secrets@bae259f9ed5b6fcb050e3b58adf7aee776d4edb5
with:
common_secrets: |
DOCKERHUB_USERNAME=dockerhub:username
DOCKERHUB_PASSWORD=dockerhub:password
repo_secrets: |
GRAFANA_PYROSCOPE_BOT_APP_APP_ID=grafana-pyroscope-bot:app-id
GRAFANA_PYROSCOPE_BOT_APP_PRIVATE_KEY=grafana-pyroscope-bot:app-private-key
- name: Get github app token (valid for an hour)
id: brew-token
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
with:
app-id: ${{ env.GRAFANA_PYROSCOPE_BOT_APP_APP_ID }}
private-key: ${{ env.GRAFANA_PYROSCOPE_BOT_APP_PRIVATE_KEY }}
owner: pyroscope-io
repositories: homebrew-brew
- uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2
name: Login to Docker Hub
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ env.DOCKERHUB_PASSWORD }}
- run: make frontend/build
- uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
with:
# ensure this aligns with the version specified in the /Makefile
version: v2.13.2
args: release --clean --timeout 60m
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_CURRENT_TAG: ${{ github.ref_name }}
# make generate-formulas expects PYROSCOPE_TAG to be set
- name: Set PYROSCOPE_TAG
run: echo "PYROSCOPE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
# Our Homebrew publishing currently assumes latest releases only
- if: env.IMAGE_PUBLISH_LATEST == 'true'
name: Update homebrew formulas
run: |
git config --global url."https://x-access-token:$(echo "${HOMEBREW_GITHUB_TOKEN}" | xargs)@github.com/pyroscope-io/homebrew-brew".insteadOf "https://github.com/pyroscope-io/homebrew-brew" 2> /dev/null
git config --global user.email "dmitry+bot@pyroscope.io"
git config --global user.name "Pyroscope Bot <dmitry+bot@pyroscope.io>"
git clone https://github.com/pyroscope-io/homebrew-brew ../homebrew-brew
cd ../homebrew-brew
make generate-formulas && git add Formula && git commit -m "chore: update formulas" && git push origin main
env:
HOMEBREW_GITHUB_TOKEN: ${{ steps.brew-token.outputs.token }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}