-
Notifications
You must be signed in to change notification settings - Fork 614
83 lines (79 loc) · 3.09 KB
/
release.yml
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
name: goreleaser
on:
push:
# run only against tags
tags:
- "v*"
# do not run for weekly release tags
- "!v0.0.0-weekly*"
permissions:
contents: write
packages: write
# issues: write
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set GIT_LAST_COMMIT_DATE
run: echo "GIT_LAST_COMMIT_DATE=$(git log -1 --date=iso-strict --format=%cd)" >> $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@v5
with:
go-version: "1.22.7"
cache: true
- uses: actions/setup-node@v3
with:
node-version: lts/hydrogen
cache: yarn
# setup docker buildx
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# login to docker hub
- uses: docker/login-action@v2
name: Login to Docker Hub
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- run: make frontend/build
- name: Get github app token (valid for an hour)
id: app-goreleaser
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: goreleaser/goreleaser-action@v6
with:
# ensure this aligns with the version specified in the /Makefile
version: v2.0.1
args: release --clean --timeout 60m
env:
GITHUB_TOKEN: ${{ steps.app-goreleaser.outputs.token }}
# make generate-formulas expects PYROSCOPE_TAG to be set
- name: Set PYROSCOPE_TAG
run: echo "PYROSCOPE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Get github app token (valid for an hour)
id: brew-token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
repository: pyroscope-io/homebrew-brew
- 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"
git config --global user.email "[email protected]"
git config --global user.name "Pyroscope Bot <[email protected]>"
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: ${{ steps.app-goreleaser.outputs.token }}