1+ name : Pre-release
2+ on :
3+ workflow_dispatch :
4+ inputs :
5+ version :
6+ description : Release version
7+ type : string
8+ required : true
9+ jobs :
10+ request-signoff :
11+ name : Send management sign-off request
12+ runs-on : ubuntu-latest
13+ steps :
14+ - name : Checkout
15+ uses : actions/checkout@v3
16+ - name : Decode configuration
17+ env :
18+ CONFIG : ${{ secrets.RELEASE_AUTOMATOR_BASE64_CONFIG }}
19+ run : |
20+ echo $CONFIG | base64 --decode > release.yaml
21+ - name : Run release-automator
22+ uses : unzerdev/unzer-tech-toolbox/.github/actions/release-changelog@main
23+ with :
24+ command : signoff
25+ version : ${{ inputs.version }}
26+
27+ release-notes :
28+ name : Generate release notes
29+ runs-on : ubuntu-latest
30+ steps :
31+ - name : Checkout
32+ uses : actions/checkout@v3
33+ - name : Decode configuration
34+ env :
35+ CONFIG : ${{ secrets.RELEASE_AUTOMATOR_BASE64_CONFIG }}
36+ run : |
37+ echo $CONFIG | base64 --decode > release.yaml
38+ - name : Run release-automator
39+ uses : unzerdev/unzer-tech-toolbox/.github/actions/release-changelog@main
40+ with :
41+ command : notes
42+ version : ${{ inputs.version }}
43+ - name : Copy out release notes file
44+ run : |
45+ sudo cp target/ReleaseNotes.md ReleaseNotes.md
46+ - name : Attach release notes
47+ uses : actions/upload-artifact@v3
48+ with :
49+ name : ReleaseNotes
50+ path : ReleaseNotes.md
51+ retention-days : 5
52+
53+ draft-release :
54+ name : Create Release Draft
55+ runs-on : ubuntu-latest
56+ needs : release-notes
57+ permissions :
58+ contents : write
59+ steps :
60+ - uses : actions/download-artifact@v3
61+ name : Download Release Notes
62+ with :
63+ name : ReleaseNotes
64+ - name : Install packages
65+ run : sudo apt-get install -y jq
66+ - name : Transform release notes to JSON escaped string
67+ run : echo "JSON_ESCAPED_RELEASE_NOTES=$(cat ReleaseNotes.md | jq --raw-input --slurp .)" >> $GITHUB_ENV
68+ - name : Create Draft Release via GitHub API
69+ run : |
70+ curl --fail-with-body --location 'https://api.github.com/repos/${{ github.repository }}/releases' \
71+ --header 'Accept: application/vnd.github+json' \
72+ --header 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
73+ --header 'X-GitHub-Api-Version: 2022-11-28' \
74+ --header 'Content-Type: application/json' \
75+ --data '{
76+ "tag_name": "${{ inputs.version }}",
77+ "target_commitish": "main",
78+ "name": "${{ inputs.version }}",
79+ "draft": true,
80+ "prerelease": false,
81+ "generate_release_notes": false,
82+ "body": ${{ env.JSON_ESCAPED_RELEASE_NOTES }}
83+ }'
84+
0 commit comments