|
| 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 | + permissions: |
| 14 | + contents: write |
| 15 | + |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2 |
| 18 | + with: |
| 19 | + fetch-depth: 0 |
| 20 | + |
| 21 | + - name: Install autoconf |
| 22 | + run: | |
| 23 | + curl -fsSL -o autoconf_2.72.deb https://archive.ubuntu.com/ubuntu/pool/main/a/autoconf/autoconf_2.72-3.1ubuntu1_all.deb |
| 24 | + sudo dpkg -i autoconf_2.72.deb |
| 25 | +
|
| 26 | + - name: Configure git |
| 27 | + run: | |
| 28 | + git config user.name "github-actions[bot]" |
| 29 | + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 30 | +
|
| 31 | + - name: Create release commit |
| 32 | + run: | |
| 33 | + is_beta=$(grep -oP "magick_is_beta\], \[\K[yn]" m4/version.m4) |
| 34 | + if [[ "$is_beta" != "y" ]]; then |
| 35 | + echo "Error: magick_is_beta is '$is_beta', expected 'y'. Aborting." |
| 36 | + exit 1 |
| 37 | + fi |
| 38 | +
|
| 39 | + sed -i 's/m4_define(\[magick_is_beta\], \[y\])/m4_define([magick_is_beta], [n])/' m4/version.m4 |
| 40 | + autoconf |
| 41 | +
|
| 42 | + version=$(grep -oP "PACKAGE_VERSION='\K[0-9\.-]+" configure) |
| 43 | + echo "Releasing version: $version" |
| 44 | +
|
| 45 | + git add configure m4/version.m4 |
| 46 | + git commit -m "release" |
| 47 | + git tag -a "$version" -m "release" |
| 48 | + git push --follow-tags |
| 49 | +
|
| 50 | + - name: Create beta release commit |
| 51 | + run: | |
| 52 | + patchlevel=$(grep -oP "magick_patchlevel_version\], \[\K[0-9]+" m4/version.m4) |
| 53 | + new_patchlevel=$((patchlevel + 1)) |
| 54 | + sed -i "s/m4_define(\[magick_patchlevel_version\], \[$patchlevel\])/m4_define([magick_patchlevel_version], [$new_patchlevel])/" m4/version.m4 |
| 55 | + sed -i 's/m4_define(\[magick_is_beta\], \[n\])/m4_define([magick_is_beta], [y])/' m4/version.m4 |
| 56 | + autoconf |
| 57 | +
|
| 58 | + git add configure m4/version.m4 |
| 59 | + git commit -m "beta release" |
| 60 | + git push |
0 commit comments