-
Notifications
You must be signed in to change notification settings - Fork 12
205 lines (197 loc) · 8.59 KB
/
release-git.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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
name: Release Git for Windows
on:
workflow_dispatch:
inputs:
git_artifacts_i686_workflow_run_id:
description: 'ID of the git-artifacts (i686) workflow run'
required: true
git_artifacts_x86_64_workflow_run_id:
description: 'ID of the git-artifacts (x86_64) workflow run'
required: true
env:
HOME: "${{github.workspace}}\\home"
USERPROFILE: "${{github.workspace}}\\home"
OWNER: git-for-windows
REPO: git
I686_WORKFLOW_RUN_ID: "${{github.event.inputs.git_artifacts_i686_workflow_run_id}}"
X86_64_WORKFLOW_RUN_ID: "${{github.event.inputs.git_artifacts_x86_64_workflow_run_id}}"
jobs:
setup:
runs-on: ubuntu-latest
outputs:
display-version: ${{ steps.bundle-artifacts.outputs.display-version }}
tag-name: ${{ steps.bundle-artifacts.outputs.tag-name }}
ver: ${{ steps.bundle-artifacts.outputs.ver }}
git-rev: ${{ steps.bundle-artifacts.outputs.git-rev }}
announcement: ${{ steps.bundle-artifacts.outputs.announcement }}
release-notes: ${{ steps.bundle-artifacts.outputs.release-notes }}
steps:
- uses: actions/checkout@v4
- name: The `release` branch must be up to date
uses: actions/github-script@v7
with:
script: |
const sha = await (async () => {
try {
return (await github.rest.git.getRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'heads/release'
})).data.object.sha
} catch (e) {
// If the ref does not exist, use an undefined `sha`
if (e?.status === 404) return undefined
throw e
}
})()
if (sha !== '${{ github.sha }}') {
console.log(`Trying to update the 'release' branch by fast-forwarding to 'main' in ${context.repo.owner}/${context.repo.repo}`)
try {
const { pushGitBranch } = require('./repository-updates.js')
await pushGitBranch(
console,
core.setSecret,
${{ secrets.GH_APP_ID }},
${{ toJSON(secrets.GH_APP_PRIVATE_KEY) }},
context.repo.owner,
context.repo.repo,
'refs/heads/main:refs/heads/release'
)
} catch(e) {
console.log(e)
throw new Error(`The 'release' branch is not up to date!
Actual: ${sha}, expected: ${{ github.sha }}.
The idea of the 'release-git' workflow is that the runs are started from
the 'main' branch and the actual jobs' definitions are maintained in
the 'release' branch, to allow modifying them and re-starting failed jobs
individually. To that end, the 'release' branch is expected to point at the
same commit as the 'main' branch when this workflow is started.`)
}
}
- name: Get bundle-artifacts and sha256sums
id: bundle-artifacts
uses: actions/github-script@v7
with:
script: |
const { downloadBundleArtifacts } = require('./github-release')
const result = await downloadBundleArtifacts(
console,
'${{ secrets.GITHUB_TOKEN }}',
context.repo.owner,
context.repo.repo,
process.env.I686_WORKFLOW_RUN_ID,
process.env.X86_64_WORKFLOW_RUN_ID
)
core.setOutput('display-version', result.displayVersion)
core.setOutput('tag-name', result.tagName)
core.setOutput('ver', result.ver)
core.setOutput('git-rev', result.gitCommitOID)
core.setOutput('announcement', result.announcement)
core.setOutput('release-notes', result.releaseNotes)
- name: Re-publish bundle-artifacts so the next job can easily use it
uses: actions/upload-artifact@v4
with:
name: bundle-artifacts
path: bundle-artifacts
github-release:
needs: ['setup']
runs-on: ubuntu-latest
steps:
- name: GitHub Release
uses: git-for-windows/git-for-windows-automation/.github/actions/github-release@release
with:
app-id: ${{ secrets.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
owner: ${{ env.OWNER }}
repo: ${{ env.REPO }}
display-version: ${{ needs.setup.outputs.display-version }}
tag-name: ${{ needs.setup.outputs.tag-name }}
rev: ${{ needs.setup.outputs.git-rev }}
release-notes: ${{ needs.setup.outputs.release-notes }}
artifacts-repository: ${{ github.repository }}
artifacts-token: ${{ secrets.GITHUB_TOKEN }}
git_artifacts_i686_workflow_run_id: ${{ env.I686_WORKFLOW_RUN_ID }}
git_artifacts_x86_64_workflow_run_id: ${{ env.X86_64_WORKFLOW_RUN_ID }}
announcement-mail:
needs: ['setup', 'github-release']
runs-on: ubuntu-latest
steps:
- name: Mail announcement
uses: git-for-windows/git-for-windows-automation/.github/actions/mail-announcement@release
with:
app-id: ${{ secrets.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
owner: ${{ env.OWNER }}
repo: ${{ env.REPO }}
display-version: ${{ needs.setup.outputs.display-version }}
rev: ${{ needs.setup.outputs.git-rev }}
announcement: ${{ needs.setup.outputs.announcement }}
smtp-server: ${{ secrets.SEND_ANNOUNCEMENT_SMTP_SERVER }}
smtp-login: ${{ secrets.SEND_ANNOUNCEMENT_SMTP_LOGIN }}
smtp-password: ${{ secrets.SEND_ANNOUNCEMENT_SMTP_PASSWORD }}
gitforwindows-site:
needs: ['setup', 'github-release']
runs-on: ubuntu-latest
steps:
- name: https://gitforwindows.org
uses: git-for-windows/git-for-windows-automation/.github/actions/gitforwindows.org@release
with:
app-id: ${{ secrets.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
owner: ${{ env.OWNER }}
repo: ${{ env.REPO }}
display-version: ${{ needs.setup.outputs.display-version }}
rev: ${{ needs.setup.outputs.git-rev }}
repository-updates:
needs: ['setup', 'github-release']
runs-on: ubuntu-latest
steps:
- name: Git repository updates (build-extra, MINGW-packages)
uses: git-for-windows/git-for-windows-automation/.github/actions/repository-updates@release
with:
app-id: ${{ secrets.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
owner: ${{ env.OWNER }}
repo: ${{ env.REPO }}
display-version: ${{ needs.setup.outputs.display-version }}
rev: ${{ needs.setup.outputs.git-rev }}
artifacts-repository: ${{ github.repository }}
artifacts-token: ${{ secrets.GITHUB_TOKEN }}
git_artifacts_x86_64_workflow_run_id: ${{ env.X86_64_WORKFLOW_RUN_ID }}
pacman-packages:
needs: ['setup']
runs-on: windows-latest
steps:
- name: Pacman packages
uses: git-for-windows/git-for-windows-automation/.github/actions/pacman-packages@release
with:
app-id: ${{ secrets.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
owner: ${{ env.OWNER }}
repo: ${{ env.REPO }}
display-version: ${{ needs.setup.outputs.display-version }}
rev: ${{ needs.setup.outputs.git-rev }}
artifacts-repository: ${{ github.repository }}
artifacts-token: ${{ secrets.GITHUB_TOKEN }}
git_artifacts_i686_workflow_run_id: ${{ env.I686_WORKFLOW_RUN_ID }}
git_artifacts_x86_64_workflow_run_id: ${{ env.X86_64_WORKFLOW_RUN_ID }}
gpg-key: ${{ secrets.GPGKEY }}
priv-gpg-key: ${{ secrets.PRIVGPGKEY }}
azure-blobs-token: ${{ secrets.AZURE_BLOBS_TOKEN }}
nuget-packages:
needs: ['setup']
runs-on: windows-latest
steps:
- name: NuGet packages
uses: git-for-windows/git-for-windows-automation/.github/actions/nuget-packages@release
with:
app-id: ${{ secrets.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
owner: ${{ env.OWNER }}
repo: ${{ env.REPO }}
display-version: ${{ needs.setup.outputs.display-version }}
rev: ${{ needs.setup.outputs.git-rev }}
artifacts-repository: ${{ github.repository }}
artifacts-token: ${{ secrets.GITHUB_TOKEN }}
git_artifacts_x86_64_workflow_run_id: ${{ env.X86_64_WORKFLOW_RUN_ID }}
nuget-api-key: ${{ secrets.NUGET_API_KEY }}