Skip to content

Allow monsters to make opportunist or zone of control attacks when th… #626

Allow monsters to make opportunist or zone of control attacks when th…

Allow monsters to make opportunist or zone of control attacks when th… #626

Workflow file for this run

name: create-github-release
on:
push:
branches: [ main ]
env:
# Used as the name when uploading or downloading the artifact for passing
# configuration data from the Setup job to those dependent on it.
CONFIG_ARTIFACT: release-config
# Used as the path for the file with the configuration data passed from
# the Setup job to those dependent on it.
CONFIG_ARTIFACT_PATH: release-config.txt
# Used as the name when uploading or downloading the artifact with the
# converted document files.
DOC_ARTIFACT: release-docs
# Used as the path for the file with the converted document files.
DOC_ARTIFACT_PATH: release-docs.tar
# Used as the name when uploading or downloading the artifact for passing
# the name of the source archive.
SRC_ARTIFACT: release-src
# Used as the path for the file with the name of the source archive in it.
SRC_ARTIFACT_PATH: release-src.txt
# Used as the name when uploading or downloading the artifact holding
# the source archive.
SRC_ARCHIVE_ARTIFACT: release-src-archive
# Used as the name when uploading or downloading the artifact for passing
# the name of the Windows archive.
WIN_ARTIFACT: release-win
# Used as the path for the file with the name of the Windows archive in it.
WIN_ARTIFACT_PATH: release-win.txt
# Used as the name when uploading or downloading the artifact holding
# the Windows archive.
WIN_ARCHIVE_ARTIFACT: release-win-archive
# Used as the name when uploading or downloading the artifact for passing
# the name of the Mac archive.
MAC_ARTIFACT: release-mac
# Used as the path for the file with the name of the Mac archive in it.
MAC_ARTIFACT_PATH: release-mac.txt
# Used as the name when uploading or downloading the artifact holding
# the Mac archive.
MAC_ARCHIVE_ARTIFACT: release-mac-archive
jobs:
setup:
name: Setup
runs-on: ubuntu-latest
steps:
# Need commit history and tags for scripts/version.sh to work as expected
# so use 0 for fetch-depth.
- name: Clone Project
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract Names from Makefile
id: get_names
run: |
name=`sed -E -n -e 's/^[[:blank:]]*NAME[[:blank:]]+=[[:blank:]]+//p' src/Makefile.src | tr ' #' '\t\t' | tail -1 | cut -f 1`
echo "name=$name" >> $GITHUB_OUTPUT
prog=`sed -E -n -e 's/^[[:blank:]]*PROGNAME[[:blank:]]+=[[:blank:]]+//p' src/Makefile.src | tr ' #' '\t\t' | tail -1 | cut -f 1`
echo "prog=$prog" >> $GITHUB_OUTPUT
- name: Set Release Version
id: get_release_vars
run: |
version=`scripts/version.sh`
echo "version=$version" >> $GITHUB_OUTPUT
prerelease=`echo $version | awk '/^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$/ { print "false" ; exit 0 } ; { print "true"; exit 0 } ;'`
echo "prerelease=$prerelease" >> $GITHUB_OUTPUT
# Mark anything that isn't a prerelease as a draft.
draft=true
if test x$prerelease = xtrue ; then
draft=false
fi
echo "draft=$draft" >> $GITHUB_OUTPUT
# The quoting here may be too simple-minded: what if there are single
# quotes in the steps.*.outputs.* stuff.
- name: Create Artifact with Configuration Details
run: |
echo name= '${{ steps.get_names.outputs.name }}' > $CONFIG_ARTIFACT_PATH
echo prog= '${{ steps.get_names.outputs.prog }}' >> $CONFIG_ARTIFACT_PATH
echo version= '${{ steps.get_release_vars.outputs.version }}' >> $CONFIG_ARTIFACT_PATH
echo prerelease= '${{ steps.get_release_vars.outputs.prerelease }}' >> $CONFIG_ARTIFACT_PATH
echo draft= '${{ steps.get_release_vars.outputs.draft }}' >> $CONFIG_ARTIFACT_PATH
- name: Upload Artifact for Use by Dependent Steps
uses: actions/upload-artifact@v4
with:
name: ${{ env.CONFIG_ARTIFACT }}
path: ${{ env.CONFIG_ARTIFACT_PATH }}
retention-days: 1
docconvert:
name: Document Conversion
runs-on: ubuntu-latest
steps:
# Need commit history and tags for scripts/version.sh to work as expected
# so use 0 for fetch-depth. Do this before installing the build
# dependencies as that step does some writing to the current directory
# and cloning the project wipes the current directory.
- name: Clone Project
uses: actions/checkout@v4
with:
fetch-depth: 0
# Need both Sphinx (Python documentation tool) and a 3rd party theme.
# Also install pip (to get theme), gcc, automake, autoconf, make
# (those four are so configuration and "make manual" work), and git
# (so scripts/version.sh works). With Python 3, use a virtual
# environment (requires at least Python 3.3) to install the 3rd party
# theme and a hacked version of sphinx-build which will use that
# environment for compatibility with "externally managed environments"
# like GitHub's runner for Ubuntu 24.04.
- name: Install Build Dependencies
id: build_dep
run: |
sudo apt-get update
sudo apt-get install autoconf automake gcc make sphinx-common git
use_python3=`python --version 2>&1 | awk "/^Python 3\\./ { print \"YES\" ; exit 0 ; } ; { print \"NO\" ; exit 0; }"`
if test X$use_python3 == XYES ; then
sudo apt-get install python3-pip
python3 -m venv .venv/doc-builder
.venv/doc-builder/bin/pip install -U sphinx
.venv/doc-builder/bin/pip install sphinx-better-theme
echo "#!${PWD}/.venv/doc-builder/bin/python" >./sphinx-build
tail -n +2 `which sphinx-build` >>./sphinx-build
chmod a+x ./sphinx-build
else
sudo apt-get install python-pip
pip install sphinx-better-theme
ln -s `which sphinx-build` ./sphinx-build
fi
# Use the version (perhaps just a symbolic link) of sphinx-build set up
# in the build dependencies step.
- name: Convert
run: |
./autogen.sh
./configure SPHINXBUILD="${PWD}/sphinx-build" --with-no-install --with-sphinx
make manual
- name: Archive
run: |
tar -cf ${{ env.DOC_ARTIFACT_PATH }} docs/_build/html
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.DOC_ARTIFACT }}
path: ${{ env.DOC_ARTIFACT_PATH }}
retention-days: 1
source:
needs: setup
name: Source Archive
runs-on: ubuntu-latest
steps:
- name: Download Artifact with Configuration Information
uses: actions/download-artifact@v4
with:
name: ${{ env.CONFIG_ARTIFACT }}
- name: Extract Configuration Information and Store in Step Outputs
id: store_config
run: |
name=`sed -E -n -e 's/name= //p' $CONFIG_ARTIFACT_PATH`
echo "name=$name" >> $GITHUB_OUTPUT
prog=`sed -E -n -e 's/prog= //p' $CONFIG_ARTIFACT_PATH`
echo "prog=$prog" >> $GITHUB_OUTPUT
version=`sed -E -n -e 's/version= //p' $CONFIG_ARTIFACT_PATH`
echo "version=$version" >> $GITHUB_OUTPUT
- name: Install Build Dependencies
run: |
sudo apt-get update
sudo apt-get install automake autoconf git make
# Need commit history and tags for scripts/version.sh to work as expected
# so use 0 for fetch-depth.
- name: Clone Project
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create Source Archive
id: create_source_archive
run: |
./autogen.sh
./configure
archive_prefix=${{ steps.store_config.outputs.name }}-${{ steps.store_config.outputs.version }}
echo "archive_file=${archive_prefix}.tar.gz" >> $GITHUB_OUTPUT
make TAG="$archive_prefix" OUT="$archive_prefix".tar.gz dist
- name: Create Artifact with Source Archive Path
run: |
echo archive_path= '${{ steps.create_source_archive.outputs.archive_file }}' > $SRC_ARTIFACT_PATH
- name: Upload Artifact with Source Archive Path
uses: actions/upload-artifact@v4
with:
name: ${{ env.SRC_ARTIFACT }}
path: ${{ env.SRC_ARTIFACT_PATH }}
retention-days: 1
- name: Upload Source Archive as Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.SRC_ARCHIVE_ARTIFACT }}
path: ${{ steps.create_source_archive.outputs.archive_file }}
retention-days: 1
windows:
needs: [setup, docconvert]
name: Windows
runs-on: ubuntu-22.04
steps:
- name: Download Artifact with Configuration Information
uses: actions/download-artifact@v4
with:
name: ${{ env.CONFIG_ARTIFACT }}
- name: Extract Configuration Information and Store in Step Outputs
id: store_config
run: |
name=`sed -E -n -e 's/name= //p' $CONFIG_ARTIFACT_PATH`
echo "name=$name" >> $GITHUB_OUTPUT
prog=`sed -E -n -e 's/prog= //p' $CONFIG_ARTIFACT_PATH`
echo "prog=$prog" >> $GITHUB_OUTPUT
version=`sed -E -n -e 's/version= //p' $CONFIG_ARTIFACT_PATH`
echo "version=$version" >> $GITHUB_OUTPUT
- name: Install Build Dependencies
run: |
sudo apt-get update
sudo apt-get install gcc-mingw-w64 automake autoconf git make zip
# Need commit history and tags for scripts/version.sh to work as expected
# so use 0 for fetch-depth.
- name: Clone Project
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download Artifact with Converted Documents
uses: actions/download-artifact@v4
with:
name: ${{ env.DOC_ARTIFACT }}
- name: Extract Converted Documents
run: |
tar -xf ${{ env.DOC_ARTIFACT_PATH }}
# Override the default CFLAGS, -g -O2, to get a smaller executable (~2
# MB versus ~7 MB), all due to compiling without debugging symbols.
# Adding the option to strip symbols and relocation information, -s,
# or the option to optimize for size, -Os, didn't further reduce the
# size of the executable when using mingw 6.0.0 on Debian buster.
- name: Create Windows Archive
id: create_windows_archive
run: |
./autogen.sh
env CFLAGS="-O2" ./configure --enable-release --enable-win --build=i686-pc-linux-gnu --host=i686-w64-mingw32
make
cp src/${{ steps.store_config.outputs.prog }}.exe src/win/dll/libpng12.dll src/win/dll/zlib1.dll .
archive_prefix=${{ steps.store_config.outputs.name }}-${{ steps.store_config.outputs.version }}
echo "archive_file=${archive_prefix}-win.zip" >> $GITHUB_OUTPUT
scripts/pkg_win $archive_prefix ${archive_prefix}-win.zip
- name: Create Artifact with Windows Archive Path
run: |
echo archive_path= '${{ steps.create_windows_archive.outputs.archive_file }}' > $WIN_ARTIFACT_PATH
- name: Upload Artifact with Windows Archive Path
uses: actions/upload-artifact@v4
with:
name: ${{ env.WIN_ARTIFACT }}
path: ${{ env.WIN_ARTIFACT_PATH }}
retention-days: 1
- name: Upload Windows Archive as Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.WIN_ARCHIVE_ARTIFACT }}
path: ${{ steps.create_windows_archive.outputs.archive_file }}
retention-days: 1
mac:
needs: [setup, docconvert]
name: Mac
runs-on: macos-latest
steps:
- name: Download Artifact with Configuration Information
uses: actions/download-artifact@v4
with:
name: ${{ env.CONFIG_ARTIFACT }}
- name: Extract Configuration Information and Store in Step Outputs
id: store_config
run: |
name=`sed -E -n -e 's/name= //p' $CONFIG_ARTIFACT_PATH`
echo "name=$name" >> $GITHUB_OUTPUT
prog=`sed -E -n -e 's/prog= //p' $CONFIG_ARTIFACT_PATH`
echo "prog=$prog" >> $GITHUB_OUTPUT
version=`sed -E -n -e 's/version= //p' $CONFIG_ARTIFACT_PATH`
echo "version=$version" >> $GITHUB_OUTPUT
# Need commit history and tags for scripts/version.sh to work as expected
# so use 0 for fetch-depth.
- name: Clone Project
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download Artifact with Converted Documents
uses: actions/download-artifact@v4
with:
name: ${{ env.DOC_ARTIFACT }}
- name: Extract Converted Documents
run: |
tar -xf ${{ env.DOC_ARTIFACT_PATH }}
# An SDK that supports building x86_64 and arm64 objects is currently
# necessary unless the default list of architectures, ARCHS, in
# Makefile.osx is overridden. If the default SDK does not handle that,
# setting SDKROOT to point to an installed SDK that does would be one
# workaround. Override the default OPT (-O2) to get the equivalent of
# what --enable-release does for builds using configure.
- name: Create Mac Archive
id: create_mac_archive
run: |
cd src
env OPT="-O2 -DNDEBUG" make -f Makefile.osx dist
archive_prefix=${{ steps.store_config.outputs.name }}-${{ steps.store_config.outputs.version }}-osx
echo "archive_file=${archive_prefix}.dmg" >> $GITHUB_OUTPUT
- name: Create Artifact with Mac Archive Path
run: |
echo archive_path= '${{ steps.create_mac_archive.outputs.archive_file }}' > $MAC_ARTIFACT_PATH
- name: Upload Artifact with Mac Archive Path
uses: actions/upload-artifact@v4
with:
name: ${{ env.MAC_ARTIFACT }}
path: ${{ env.MAC_ARTIFACT_PATH }}
retention-days: 1
- name: Upload Mac Archive as Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.MAC_ARCHIVE_ARTIFACT }}
path: ${{ steps.create_mac_archive.outputs.archive_file }}
retention-days: 1
release:
needs: [ setup, source, windows, mac ]
name: Create GitHub Release
runs-on: ubuntu-latest
steps:
- name: Download Artifact with Configuration Information
uses: actions/download-artifact@v4
with:
name: ${{ env.CONFIG_ARTIFACT }}
- name: Extract Configuration Information and Store in Step Outputs
id: store_config
run: |
version=`sed -E -n -e 's/version= //p' $CONFIG_ARTIFACT_PATH`
echo "version=$version" >> $GITHUB_OUTPUT
prerelease=`sed -E -n -e 's/prerelease= //p' $CONFIG_ARTIFACT_PATH`
echo "prerelease=$prerelease" >> $GITHUB_OUTPUT
draft=`sed -E -n -e 's/draft= //p' $CONFIG_ARTIFACT_PATH`
echo "draft=$draft" >> $GITHUB_OUTPUT
- name: Download Artifact with Source Archive Path
uses: actions/download-artifact@v4
with:
name: ${{ env.SRC_ARTIFACT }}
- name: Extract Source Archive Path and Store in Step Outputs
id: store_src
run: |
archive_path=`sed -E -n -e 's/archive_path= //p' $SRC_ARTIFACT_PATH`
echo "archive_path=$archive_path" >> $GITHUB_OUTPUT
- name: Download Artifact with Source Archive
uses: actions/download-artifact@v4
with:
name: ${{ env.SRC_ARCHIVE_ARTIFACT }}
- name: Download Artifact with Windows Archive Path
uses: actions/download-artifact@v4
with:
name: ${{ env.WIN_ARTIFACT }}
- name: Extract Windows Archive Path and Store in Step Outputs
id: store_win
run: |
archive_path=`sed -E -n -e 's/archive_path= //p' $WIN_ARTIFACT_PATH`
echo "archive_path=$archive_path" >> $GITHUB_OUTPUT
- name: Download Artifact with Windows Archive
uses: actions/download-artifact@v4
with:
name: ${{ env.WIN_ARCHIVE_ARTIFACT }}
- name: Download Artifact with Mac Archive Path
uses: actions/download-artifact@v4
with:
name: ${{ env.MAC_ARTIFACT }}
- name: Extract Mac Archive Path and Store in Step Outputs
id: store_mac
run: |
archive_path=`sed -E -n -e 's/archive_path= //p' $MAC_ARTIFACT_PATH`
echo "archive_path=$archive_path" >> $GITHUB_OUTPUT
- name: Download Artifact with Mac Archive
uses: actions/download-artifact@v4
with:
name: ${{ env.MAC_ARCHIVE_ARTIFACT }}
- name: Populate Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.store_config.outputs.version }}
name: ${{ steps.store_config.outputs.version }}
target_commitish: ${{ github.sha }}
draft: ${{ steps.store_config.outputs.draft }}
prerelease: ${{ steps.store_config.outputs.prerelease }}
files: |
${{ steps.store_src.outputs.archive_path }}
${{ steps.store_win.outputs.archive_path }}
${{ steps.store_mac.outputs.archive_path }}
token: ${{ secrets.GITHUB_TOKEN }}