Release #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
release: | |
types: [published] | |
schedule: | |
- cron: "0 5 * * MON" | |
workflow_dispatch: {} | |
jobs: | |
update-autorevision: | |
name: "Update AutoRevision" | |
runs-on: ubuntu-22.04 | |
if: github.event_name == 'release' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- # Make sure there are no unstaged changes | |
# Was reporting changes to eol=crlf files in .gitattributes | |
run: git checkout -- . | |
- run: git rev-parse --short=5 HEAD > cmake/AutoRevision.txt | |
- run: git describe --tags `git rev-list --tags --max-count=1` >> cmake/AutoRevision.txt | |
- run: cat cmake/AutoRevision.txt | |
- name: Find target branch | |
id: branch | |
# We're running on a tag so have no direct access to the branch. Find it. | |
# Strip the first 3 components (ref/remotes/username) | |
run: | | |
branch=$(git branch -r --contains HEAD --format '%(refname:strip=3)') | |
echo Target branch is $branch | |
echo branch=$branch >> $GITHUB_OUTPUT | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
base: ${{ steps.branch.outputs.branch }} | |
commit-message: "Release update of AutoRevision.txt" | |
branch: release/autorevision/${{ steps.branch.outputs.branch }} | |
title: "Release update of AutoRevision.txt" | |
body: > | |
Automatic changes triggered by a new release. | |
This PR updates `${{ steps.branch.outputs.branch }}`. | |
Close and reopen this pull request to start the CI. | |
delete-branch: true | |
update-archive: | |
name: "Update Source Archive" | |
runs-on: ubuntu-22.04 | |
if: github.event_name == 'release' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- run: git rev-parse --short=5 HEAD > cmake/AutoRevision.txt | |
- run: git describe --tags `git rev-list --tags --max-count=1` >> cmake/AutoRevision.txt | |
- run: cat cmake/AutoRevision.txt | |
- name: Make build directory | |
run: mkdir -p -v $PWD/build | |
- name: Create tar.gz | |
run: | | |
git archive --format=tar.gz --prefix=Freeciv21-${{github.ref_name}}/ -o $PWD/build/Freeciv21-${{github.ref_name}}.tar.gz HEAD | |
sha256sum --binary $PWD/build/Freeciv21-${{github.ref_name}}.tar.gz > $PWD/build/Freeciv21-${{github.ref_name}}.tar.gz.sha256 | |
- name: Create zip | |
run: | | |
git archive --format=zip --prefix=Freeciv21-${{github.ref_name}}/ -o $PWD/build/Freeciv21-${{github.ref_name}}.zip HEAD | |
sha256sum --binary $PWD/build/Freeciv21-${{github.ref_name}}.zip > $PWD/build/Freeciv21-${{github.ref_name}}.zip.sha256 | |
- name: Upload package | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
build/Freeciv21-${{github.ref_name}}.tar.gz | |
build/Freeciv21-${{github.ref_name}}.tar.gz.sha256 | |
build/Freeciv21-${{github.ref_name}}.zip | |
build/Freeciv21-${{github.ref_name}}.zip.sha256 | |
i686-windows: | |
name: "Create i686 Windows Package" | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: msys2 {0} | |
if: github.event_name == 'release' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: msys2/setup-msys2@v2 | |
with: | |
msystem: MINGW32 | |
update: true | |
install: | | |
git | |
mingw-w64-i686-cmake | |
mingw-w64-i686-ninja | |
mingw-w64-i686-nsis | |
mingw-w64-i686-gcc | |
mingw-w64-i686-libunwind | |
mingw-w64-i686-readline | |
mingw-w64-i686-lua | |
mingw-w64-i686-SDL2_mixer | |
mingw-w64-i686-qt5-base | |
mingw-w64-i686-qt5-svg | |
mingw-w64-i686-karchive-qt5 | |
- name: Configure | |
run: | | |
export PATH=/mingw32/bin:${PATH} | |
export MSYSTEM=MINGW32 | |
export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:/mingw32/lib/pkgconfig:/mingw32/share/pkgconfig | |
cmake . -B build -G Ninja \ | |
-DCMAKE_INSTALL_PREFIX=$PWD/build/install \ | |
-DCMAKE_BUILD_TYPE=Release | |
- name: Build | |
run: | | |
cmake --build build | |
- name: Install | |
run: | | |
cmake --build build --target install | |
- name: Package | |
run: | | |
cmake --build build --target package | |
- name: Upload package | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
build/Windows-i686/Freeciv21-*-Windows-i686.exe | |
build/Windows-i686/Freeciv21-*-Windows-i686.exe.sha256 |