-
-
Notifications
You must be signed in to change notification settings - Fork 34
188 lines (166 loc) Β· 5.32 KB
/
goreleaser.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
name: Goreleaser
on:
pull_request:
branches:
- main
types:
- closed
push:
tags: ["v*"]
jobs:
tagger:
runs-on: ubuntu-latest
permissions:
contents: write # to create new tag
steps:
- name: Create tag
id: create
uses: actions/github-script@v7
if: github.event_name == 'pull_request' && github.event.pull_request.merged && startsWith(github.event.pull_request.head.ref, 'release/')
with:
github-token: ${{ github.token }}
script: |
const tag = context.payload.pull_request.head.ref.replace("release/", "v")
try {
await github.rest.git.deleteRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/" + tag,
})
} catch {
}
await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/" + tag,
sha: context.payload.pull_request.merge_commit_sha,
})
return tag
result-encoding: string
- name: Get pushed tag
id: push
if: github.event_name == 'push'
run: echo "result=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
- name: combine tags
id: combined
run: echo "tag=${PUSHED_TAG}${CREATED_TAG}" >> $GITHUB_OUTPUT
env:
CREATED_TAG: ${{ steps.create.outputs.result }}
PUSHED_TAG: ${{ steps.push.outputs.result }}
outputs:
tag: ${{ steps.combined.outputs.tag }}
generate-changelog:
runs-on: ubuntu-latest
permissions:
contents: write # to commit merged changelog
pull-requests: write # to create PR
needs:
- tagger
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Download changie
run: go install github.com/miniscruff/changie@v1
- name: Generate release changelog
run: changie batch $TAG --force
env:
TAG: ${{ needs.tagger.outputs.tag }}
- name: Upload changelog artifact
uses: actions/upload-artifact@v4
with:
name: changelog
path: .changes/${{ needs.tagger.outputs.tag }}.md
- name: Merge changelog
run: changie merge
- name: Create Pull Request for changelog
uses: peter-evans/create-pull-request@v6
with:
add-paths: |
CHANGELOG.md
.changes
commit-message: "chore: update changelog"
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
branch: "${{ needs.tagger.outputs.tag }}-changelog"
delete-branch: true
title: "chore: update changelog"
goreleaser:
runs-on: ubuntu-latest
permissions:
contents: write # to create release
issues: write # to close milestone
packages: write # to upload package
needs:
- tagger
- generate-changelog
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ needs.tagger.outputs.tag }}
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Download changelog artifact
uses: actions/download-artifact@v4
with:
name: changelog
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --skip-validate --clean --release-notes ${{ needs.tagger.outputs.tag }}.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.CR_PAT }}
TELEGRAM_TOKEN: ${{ secrets.BOT_TOKEN }}
- name: Generate schema.json
run: ./dist/helmwave_linux_amd64_v1/helmwave schema > schema.json
- name: Upload schema.json
uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: "schema.json"
update_latest_release: true
docs:
runs-on: ubuntu-latest
needs:
- tagger
steps:
- name: Trigger helmwave/docs workflow
uses: actions/github-script@v7
with:
github-token: ${{ secrets.PAT }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: "docs",
workflow_id: "generate-new-version.yml",
ref: "main",
inputs: {
tag: process.env.GITHUB_TAG,
},
})
env:
GITHUB_TAG: ${{ needs.tagger.outputs.tag }}