50 lines
1.8 KiB
YAML
50 lines
1.8 KiB
YAML
# SPDX-License-Identifier: GPL-3.0-only
|
|
name: Prepare release packages
|
|
|
|
on:
|
|
push:
|
|
tags: ['v*']
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
build:
|
|
uses: ./.github/workflows/ci.yml
|
|
draft:
|
|
needs: build
|
|
runs-on: ubuntu-24.04
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
persist-credentials: false
|
|
fetch-depth: 0
|
|
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
|
with:
|
|
pattern: OpenBMH-*
|
|
path: dist
|
|
merge-multiple: true
|
|
- name: Create draft for review
|
|
shell: python
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
RELEASE_TAG: ${{ github.ref_name }}
|
|
run: |
|
|
import os, pathlib, re, subprocess
|
|
tag = os.environ['RELEASE_TAG']
|
|
match = re.fullmatch(r'v([0-9]+)\.([0-9]+)\.[0-9]+(?:[-+][A-Za-z0-9.-]+)?', tag)
|
|
if not match:
|
|
raise SystemExit('Invalid release tag')
|
|
notes = pathlib.Path('docs/release') / (match[1] + '.' + match[2]) / 'RELEASE_NOTES.md'
|
|
packages = sorted(pathlib.Path('dist').glob('*.zip'))
|
|
expected = {'OpenBMH-' + tag[1:] + '-' + kind + '.zip'
|
|
for kind in ('windows-x64', 'linux-x64', 'macos-arm64', 'source')}
|
|
if {p.name for p in packages} != expected:
|
|
raise SystemExit('Missing, unexpected or mismatched release package')
|
|
if not notes.is_file():
|
|
raise SystemExit('Release notes missing for ' + tag)
|
|
subprocess.run(['gh', 'release', 'create', tag, *map(str, packages), '--draft',
|
|
'--verify-tag', '--title', 'OpenBMH ' + tag, '--notes-file', str(notes)], check=True)
|