Skip to content

Release

Release #51

Workflow file for this run

name: Release
on:
release:
types: [published]
workflow_dispatch: {}
jobs:
update-autorevision:
name: "Update AutoRevision"
runs-on: ubuntu-22.04
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 status
- run: git stash
- 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
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: Make build directory
run: mkdir -p -v $PWD/build
- name: Create tar.gz
run: |
tar --exclude='build' --exclude='data/graphics' -cvzf Freeciv21-${{github.ref_name}}.tar.gz ../freeciv21/*
sha256sum --binary Freeciv21-${{github.ref_name}}.tar.gz > Freeciv21-${{github.ref_name}}.tar.gz.sha256
- name: Create zip
run: |
cd ..
zip -r freeciv21/Freeciv21-${{github.ref_name}}.zip freeciv21/* -x \*/build/* \*.gz \*.sha256 \*/data/graphics/* \*/.*
cd freeciv21
sha256sum --binary Freeciv21-${{github.ref_name}}.zip > Freeciv21-${{github.ref_name}}.zip.sha256
- name: Upload package
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
Freeciv21-${{github.ref_name}}.tar.gz
Freeciv21-${{github.ref_name}}.tar.gz.sha256
Freeciv21-${{github.ref_name}}.zip
Freeciv21-${{github.ref_name}}.zip.sha256
snapcraft:
name: "Snap Package"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install \
cmake \
ninja-build \
gettext \
qtbase5-dev \
libqt5svg5-dev \
libkf5archive-dev \
liblua5.3-dev \
libsqlite3-dev \
libsdl2-mixer-dev
- name: Debug
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.JW_SECRET }}
run: |
echo "$JW_SECRET"
- name: Configure
run: |
mkdir -p build/snap/local
cmake . -B build -G Ninja
cp data/icons/128x128/freeciv21-client.png build/snap/local
- uses: snapcore/action-build@v1
id: snapcraft
with:
path: build
- uses: snapcore/action-publish@v1
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }}
with:
snap: ${{ steps.snapcraft.outputs.snap }}
release: beta