Add a GitHub Actions workflow for creating releases

This takes care of the easy to automate steps.
This commit is contained in:
Vadim Zeitlin 2022-09-03 15:37:58 +02:00
parent 955f11504b
commit d5a9d99781

121
.github/workflows/make_release.yml vendored Normal file
View file

@ -0,0 +1,121 @@
# This manually triggered workflow creates a new draft release.
name: Create Release
on:
workflow_dispatch:
inputs:
version:
description: 'Release version'
required: true
permissions:
contents: write
jobs:
add_release_sources:
runs-on: ubuntu-22.04
name: Create Release with Source Archives
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Install Required Tools
run: |
sudo apt-get -q -o=Dpkg::Use-Pty=0 -y install doxygen gettext graphviz
- name: Create Release Archives
run: ./build/tools/release.sh ${{ inputs.version }}
# This is not very elegant, but we can't update checksums from two
# different jobs, so we just append to the release body which then
# needs to be edited interactively.
- name: Create Archives Checksums
working-directory: distrib/release/${{ inputs.version }}
run: |
printf '\n# THESE CHECKSUMS MUST BE MOVED ABOVE!\n\n````' >> ../../../docs/release.md
sha1sum * >> ../../../docs/release.md
- name: Create Draft Release
# Note: use latest available (as of 2022-09-03) action version as v1
# doesn't include the "assets" output that we need to pass the
# download URL to the next job. Replace the SHA-1 with tag when a
# release including "assets" output support is made.
uses: softprops/action-gh-release@cd28b0f5ee8571b76cfdaa62a30d51d752317477
id: create_release
with:
name: wxWidgets ${{ inputs.version }}
body_path: docs/release.md
files: |
distrib/release/${{ inputs.version }}/wxWidgets-${{ inputs.version }}.zip
distrib/release/${{ inputs.version }}/wxWidgets-${{ inputs.version }}.7z
distrib/release/${{ inputs.version }}/wxWidgets-${{ inputs.version }}.tar.bz2
distrib/release/${{ inputs.version }}/wxWidgets-${{ inputs.version }}-headers.7z
distrib/release/${{ inputs.version }}/wxWidgets-${{ inputs.version }}-docs-html.zip
distrib/release/${{ inputs.version }}/wxWidgets-${{ inputs.version }}-docs-html.tar.bz2
fail_on_unmatched_files: true
draft: true
# We have to store the archive used by the job below as an artifact
# because it can't be downloaded from a draft release without
# impersonating the same user and I don't know how to do it.
- name: Upload Release Archive
uses: actions/upload-artifact@v3
with:
name: wxWidgets-${{ inputs.version }}-source-archive
path: distrib/release/${{ inputs.version }}/wxWidgets-${{ inputs.version }}.zip
retention-days: 1
add_msw_files:
needs: add_release_sources
runs-on: windows-2022
name: Add MSW Files to the Release
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download Release Archive
uses: actions/download-artifact@v3
with:
name: wxWidgets-${{ inputs.version }}-source-archive
- name: Install Prerequisites
run: |
choco install -y --no-progress graphviz html-help-workshop
- name: Create MSW Installer and Help File
shell: cmd
run: |
md distrib\release
md distrib\release\${{ inputs.version }}
move wxWidgets-${{ inputs.version }}.zip distrib\release\${{ inputs.version }}
set "PATH=C:\Program Files (x86)\HTML Help Workshop;%PATH%"
build\tools\release.bat ${{ inputs.version }}
# This doesn't really decrease the file size but .chm files can't be
# uploaded to GitHub, while .zip files can.
- name: Pack CHM File
working-directory: distrib/release/${{ inputs.version }}
run: 7z a wxWidgets-${{ inputs.version }}-docs-chm.zip wxWidgets-${{ inputs.version }}.chm
- name: Create Archives Checksums
working-directory: distrib/release/${{ inputs.version }}
shell: cmd
run: |
sha1sum * > ../../../checksums
type ../../../checksums
- name: Add Files to the Release
uses: softprops/action-gh-release@cd28b0f5ee8571b76cfdaa62a30d51d752317477
with:
name: wxWidgets ${{ inputs.version }}
body_path: checksums
append_body: true
files: |
distrib/release/${{ inputs.version }}/wxMSW-${{ inputs.version }}-Setup.exe
distrib/release/${{ inputs.version }}/wxWidgets-${{ inputs.version }}-docs-chm.zip
fail_on_unmatched_files: true
draft: true