Skip to content

Prepare Release

Prepare Release #13

Workflow file for this run

# 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 v${{ inputs.version }} rules_nixpkgs-${{ inputs.version }}.tar.gz