Skip to content

Commit 9545c6a

Browse files
committed
ci: generate github release notes separately from creating github release
Since creating the github release is security sensitive, better to isolate the part of generating the markdown release notes in its own job, such that if e.g. pip/tox/pandoc is compromised it could not in turn compromise the release files.
1 parent d322dae commit 9545c6a

File tree

1 file changed

+31
-15
lines changed

1 file changed

+31
-15
lines changed

.github/workflows/deploy.yml

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -69,28 +69,18 @@ jobs:
6969
git tag --annotate --message=v"$VERSION" "$VERSION" ${{ github.sha }}
7070
git push origin "$VERSION"
7171
72-
release-notes:
73-
74-
# todo: generate the content in the build job
75-
# the goal being of using a github action script to push the release data
76-
# after success instead of creating a complete python/tox env
77-
needs: [deploy]
72+
generate-gh-release-notes:
73+
needs: [package]
7874
runs-on: ubuntu-latest
7975
timeout-minutes: 30
8076
permissions:
81-
contents: write
77+
contents: read
8278
steps:
8379
- uses: actions/checkout@v5
8480
with:
8581
fetch-depth: 0
8682
persist-credentials: false
8783

88-
- name: Download Package
89-
uses: actions/download-artifact@v6
90-
with:
91-
name: Packages
92-
path: dist
93-
9484
- name: Set up Python
9585
uses: actions/setup-python@v6
9686
with:
@@ -106,11 +96,37 @@ jobs:
10696
VERSION: ${{ github.event.inputs.version }}
10797
run: |
10898
sudo apt-get install pandoc
109-
tox -e generate-gh-release-notes -- "$VERSION" scripts/latest-release-notes.md
99+
tox -e generate-gh-release-notes -- "$VERSION" gh-release-notes.md
100+
101+
- name: Upload release notes
102+
uses: actions/upload-artifact@v4
103+
with:
104+
name: release-notes
105+
path: gh-release-notes.md
106+
retention-days: 1
107+
108+
create-github-release:
109+
needs: [generate-gh-release-notes, deploy]
110+
runs-on: ubuntu-latest
111+
timeout-minutes: 10
112+
permissions:
113+
contents: write
114+
steps:
115+
- name: Download Package
116+
uses: actions/download-artifact@v6
117+
with:
118+
name: Packages
119+
path: dist
120+
121+
- name: Download release notes
122+
uses: actions/download-artifact@v6
123+
with:
124+
name: release-notes
125+
path: .
110126

111127
- name: Publish GitHub Release
112128
env:
113129
VERSION: ${{ github.event.inputs.version }}
114130
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
115131
run: |
116-
gh release create --notes-file scripts/latest-release-notes.md --verify-tag "$VERSION" dist/*
132+
gh release create --notes-file gh-release-notes.md --verify-tag "$VERSION" dist/*

0 commit comments

Comments
 (0)