-
Notifications
You must be signed in to change notification settings - Fork 2
84 lines (81 loc) · 2.75 KB
/
pre-release.yml
File metadata and controls
84 lines (81 loc) · 2.75 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
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
name: Pre-release Java SDK
on:
workflow_dispatch:
inputs:
version:
description: Release version
type: string
required: true
jobs:
request-signoff:
name: Send management sign-off request
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Decode configuration
env:
CONFIG: ${{ secrets.RELEASE_AUTOMATOR_BASE64_CONFIG }}
run: |
echo $CONFIG | base64 --decode > release.yaml
- name: Run release-automator
uses: unzerdev/unzer-tech-toolbox/.github/actions/release-changelog@main
with:
command: signoff
version: ${{ inputs.version }}
release-notes:
name: Generate release notes
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Decode configuration
env:
CONFIG: ${{ secrets.RELEASE_AUTOMATOR_BASE64_CONFIG }}
run: |
echo $CONFIG | base64 --decode > release.yaml
- name: Run release-automator
uses: unzerdev/unzer-tech-toolbox/.github/actions/release-changelog@main
with:
command: notes
version: ${{ inputs.version }}
- name: Copy out release notes file
run: |
sudo cp target/ReleaseNotes.md ReleaseNotes.md
- name: Attach release notes
uses: actions/upload-artifact@v3
with:
name: ReleaseNotes
path: ReleaseNotes.md
retention-days: 5
draft-release:
name: Create Release Draft
runs-on: ubuntu-latest
needs: release-notes
permissions:
contents: write
steps:
- uses: actions/download-artifact@v3
name: Download Release Notes
with:
name: ReleaseNotes
- name: Install packages
run: sudo apt-get install -y jq
- name: Transform release notes to JSON escaped string
run: echo "JSON_ESCAPED_RELEASE_NOTES=$(cat ReleaseNotes.md | jq --raw-input --slurp .)" >> $GITHUB_ENV
- name: Create Draft Release via GitHub API
run: |
curl --fail-with-body --location 'https://api.github.com/repos/${{ github.repository }}/releases' \
--header 'Accept: application/vnd.github+json' \
--header 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'X-GitHub-Api-Version: 2022-11-28' \
--header 'Content-Type: application/json' \
--data '{
"tag_name": "${{ inputs.version }}",
"target_commitish": "main",
"name": "${{ inputs.version }}",
"draft": true,
"prerelease": false,
"generate_release_notes": false,
"body": ${{ env.JSON_ESCAPED_RELEASE_NOTES }}
}'