-
Notifications
You must be signed in to change notification settings - Fork 81
49 lines (46 loc) · 1.51 KB
/
release.yaml
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
# Create a draft release when triggered via Github's UI or Github CLI
name: Prepare Release
on:
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g. 0.11.0)'
required: true
type: string
permissions:
contents: write
jobs:
release:
name: Prepare Release
runs-on: ubuntu-latest
steps:
- name: Check version
run: |
if ! [[ '${{ inputs.version }}' =~ ^[0-9]+[.][0-9]+[.][0-9]+$ ]]; then
echo '${{ inputs.version }} does not match expected format `major.minor.patch`' >&2
exit 1
fi
- name: Checkout
uses: actions/checkout@v4
with:
ref: master # only create releases from main branch
- name: Read section from CHANGELOG.md
id: extract-changelog
uses: sean0x42/markdown-extract@v2
with:
file: CHANGELOG.md
pattern: ${{ inputs.version }}
- name: Prepare release notes and artifacts
run: |
.github/workflows/release_prep.sh v${{ inputs.version }} > release_notes.txt
printf '${{ steps.extract-changelog.outputs.markdown }}' >> release_notes.txt
- name: Create draft release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create \
--draft \
--notes-file release_notes.txt \
--title v${{ inputs.version }} \
v${{ inputs.version }} \
rules_nixpkgs-${{ inputs.version }}.tar.gz