Release #41
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 | |
- # 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 * | |
sha256sum --binary Freeciv21-${{github.ref_name}}.tar.gz > Freeciv21-${{github.ref_name}}.tar.gz.sha256 | |
- name: Create zip | |
run: | | |
zip -r Freeciv21-${{github.ref_name}}.zip * -x \/build/* \*.gz \*.sha256 \/data/graphics/* | |
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 |