Repository navigation
59 lines (51 loc) · 1.88 KB
/
Copy pathrelease.yml
File metadata and controls
59 lines (51 loc) · 1.88 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
# A merge that changes the version IS the release. When main's pyproject.toml
# names a version with a CHANGELOG heading and no tag yet, this tags it, and the
# tag push runs container.yml, which promotes the image to that version and then
# opens a bump PR in every repo that pins python-sdlc.
#
# Without this, a tool update that merged itself would sit untagged until a
# person noticed, and no repo would receive it.
name: Release
on:
push:
branches: [main]
concurrency:
group: release
cancel-in-progress: false
permissions: {}
jobs:
release:
name: Tag a new version
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Is there an untagged version?
id: version
env:
GH_TOKEN: ${{ github.token }}
run: |
set -eu
tag=$(scripts/release-version.sh)
echo "tag=$tag" >> "$GITHUB_OUTPUT"
# The App's token, because a tag created with GITHUB_TOKEN does not start
# container.yml, and the release would never be promoted.
- name: Mint CI token
if: steps.version.outputs.tag != ''
id: ci-token
uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0
with:
client-id: ${{ vars.CRUNCHTOOLS_CI_CLIENT_ID }}
private-key: ${{ secrets.CRUNCHTOOLS_CI_APP_KEY }}
owner: crunchtools
- name: Release
if: steps.version.outputs.tag != ''
env:
GH_TOKEN: ${{ steps.ci-token.outputs.token }}
TAG: ${{ steps.version.outputs.tag }}
run: |
set -eu
v=${TAG#v}
notes=$(awk -v h="## [$v]" 'index($0, h) == 1 {f=1; next} f && /^## \[/ {exit} f' CHANGELOG.md)
gh release create "$TAG" --target "$GITHUB_SHA" --title "$TAG" --notes "$notes"