Repository navigation
66 lines (61 loc) · 1.81 KB
/
Copy pathrelease.yaml
File metadata and controls
66 lines (61 loc) · 1.81 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
name: Release
on:
push:
branches:
- main
jobs:
release:
runs-on: ubuntu-slim
steps:
- uses: actions/create-github-app-token@v3
id: token
with:
client-id: ${{ secrets.GH_CLIENT_ID }}
private-key: ${{ secrets.GH_PRIVATE_KEY }}
- uses: googleapis/release-please-action@v5
id: release
with:
token: ${{ steps.token.outputs.token }}
skip-github-pull-request: "${{ contains(github.event.head_commit.message, 'chore: release') }}"
- if: steps.release.outputs.release_created
uses: actions/github-script@v9
with:
github-token: ${{ steps.token.outputs.token }}
script: |
const tag = '${{ steps.release.outputs.tag_name }}';
// Create annotated tag
const result = await github.rest.git.createTag({
...context.repo,
tag,
message: `Release ${tag}`,
type: 'commit',
object: context.sha,
});
const sha = result.data.sha;
// Create the ref
await github.rest.git.createRef({
...context.repo,
sha,
ref: `refs/tags/${tag}`,
});
core.setOutput('sha', sha);
outputs:
released: ${{ steps.release.outputs.release_created }}
goreleaser:
runs-on: ubuntu-latest
needs: release
if: needs.release.outputs.released
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: actions/setup-go@v7
with:
go-version-file: go.mod
check-latest: true
cache: true
- uses: goreleaser/goreleaser-action@v7
with:
args: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}