| 1 |
on: |
| 2 |
workflow_dispatch: |
| 3 |
|
| 4 |
permissions: |
| 5 |
contents: read |
| 6 |
|
| 7 |
name: Publish release |
| 8 |
jobs: |
| 9 |
publish: |
| 10 |
name: Publish release |
| 11 |
runs-on: ubuntu-24.04 |
| 12 |
|
| 13 |
steps: |
| 14 |
- name: Install autoconf |
| 15 |
run: | |
| 16 |
curl -fsSL -o autoconf_2.72.deb https://archive.ubuntu.com/ubuntu/pool/main/a/autoconf/autoconf_2.72-3.1ubuntu1_all.deb |
| 17 |
sudo dpkg -i autoconf_2.72.deb |
| 18 |
|
| 19 |
- name: Create GitHub app token |
| 20 |
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 |
| 21 |
id: app-token |
| 22 |
with: |
| 23 |
client-id: ${{vars.APP_CLIENT_ID}} |
| 24 |
private-key: ${{secrets.APP_PRIVATE_KEY}} |
| 25 |
permission-contents: write |
| 26 |
|
| 27 |
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 |
| 28 |
with: |
| 29 |
fetch-depth: 0 |
| 30 |
token: ${{steps.app-token.outputs.token}} |
| 31 |
|
| 32 |
- name: Configure git |
| 33 |
run: | |
| 34 |
git config --global user.name '${{steps.app-token.outputs.app-slug}}[bot]' |
| 35 |
git config --global user.email '${{vars.APP_USER_ID}}+${{steps.app-token.outputs.app-slug}}[bot]@users.noreply.github.com' |
| 36 |
|
| 37 |
- name: Create release commit |
| 38 |
run: | |
| 39 |
is_beta=$(grep -oP "magick_is_beta\], \[\K[yn]" m4/version.m4) |
| 40 |
if [[ "$is_beta" != "y" ]]; then |
| 41 |
echo "Error: magick_is_beta is '$is_beta', expected 'y'. Aborting." |
| 42 |
exit 1 |
| 43 |
fi |
| 44 |
|
| 45 |
sed -i 's/m4_define(\[magick_is_beta\], \[y\])/m4_define([magick_is_beta], [n])/' m4/version.m4 |
| 46 |
autoconf |
| 47 |
|
| 48 |
version=$(grep -oP "PACKAGE_VERSION='\K[0-9\.-]+" configure) |
| 49 |
echo "Releasing version: $version" |
| 50 |
|
| 51 |
git add configure m4/version.m4 |
| 52 |
git commit -m "release" |
| 53 |
git tag -a "$version" -m "release" |
| 54 |
git push --follow-tags |
| 55 |
|
| 56 |
- name: Create beta release commit |
| 57 |
run: | |
| 58 |
patchlevel=$(grep -oP "magick_patchlevel_version\], \[\K[0-9]+" m4/version.m4) |
| 59 |
new_patchlevel=$((patchlevel + 1)) |
| 60 |
sed -i "s/m4_define(\[magick_patchlevel_version\], \[$patchlevel\])/m4_define([magick_patchlevel_version], [$new_patchlevel])/" m4/version.m4 |
| 61 |
sed -i 's/m4_define(\[magick_is_beta\], \[n\])/m4_define([magick_is_beta], [y])/' m4/version.m4 |
| 62 |
autoconf |
| 63 |
|
| 64 |
git add configure m4/version.m4 |
| 65 |
git commit -m "beta release" |
| 66 |
git push |