Repository navigation
84 lines (82 loc) · 3.26 KB
/
Copy pathrelease.yaml
File metadata and controls
84 lines (82 loc) · 3.26 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
name: Release
on:
push:
branches:
- main
permissions:
contents: write # to create release commit (google-github-actions/release-please-action)
pull-requests: write # to create release PR (google-github-actions/release-please-action)
issues: write # to create release issue (google-github-actions/release-please-action)
jobs:
goreleaser:
# runs-on: blacksmith-2vcpu-ubuntu-2404
runs-on: ubuntu-24.04
environment: CI
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
- uses: actions/checkout@v5
with:
fetch-depth: 0
- run: git fetch --force --tags
# release-please reports release_created only on the run that tags the
# release. If goreleaser then fails (v0.1.97: Apple notarization), a
# re-run of this workflow would skip it and leave the release without
# binaries, so a re-run publishes the tag on HEAD while its release has
# no assets.
- name: Find release to publish
id: publish
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_CREATED: ${{ steps.release.outputs.release_created }}
RELEASE_TAG: ${{ steps.release.outputs.tag_name }}
run: |
if [ "$RELEASE_CREATED" = "true" ]; then
echo "tag=$RELEASE_TAG" >> "$GITHUB_OUTPUT"
exit 0
fi
tag=$(git tag --points-at HEAD --list 'v*' --sort=-v:refname | head -n 1)
if [ -z "$tag" ]; then
exit 0
fi
# A separate assignment, so a failing gh fails the step instead of
# quietly skipping goreleaser.
assets=$(gh release view "$tag" --json assets --jq '.assets | length')
if [ "$assets" = "0" ]; then
echo "Release $tag has no assets, publishing it again"
echo "tag=$tag" >> "$GITHUB_OUTPUT"
fi
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Generate
run: |
echo "GH_TAG=$(echo $GITHUB_REF | awk -F / '{print $3}')" >> $GITHUB_ENV
go install github.com/vektra/mockery/v3@v3.7.4
mockery
- name: Test
run: go test -timeout 3m -coverprofile=coverage.txt -covermode=atomic ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5.4.3
with:
token: ${{ secrets.CODECOV_TOKEN }}
- uses: goreleaser/goreleaser-action@v6
if: ${{ steps.publish.outputs.tag != '' }}
with:
distribution: goreleaser
version: "~> v2"
args: release --clean
env:
VERSION: ${{ steps.publish.outputs.tag }}
UPTRACE_DSN: ${{ secrets.UPTRACE_DSN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
QUILL_SIGN_P12: ${{ secrets.QUILL_SIGN_P12 }}
QUILL_SIGN_PASSWORD: ${{ secrets.QUILL_SIGN_PASSWORD }}
QUILL_NOTARY_KEY: ${{ secrets.QUILL_NOTARY_KEY }}
QUILL_NOTARY_KEY_ID: ${{ secrets.QUILL_NOTARY_KEY_ID }}
QUILL_NOTARY_ISSUER: ${{ secrets.QUILL_NOTARY_ISSUER }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}