mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
The assemble job only ran on Windows for the case-insensitive filesystem, which the overlays no longer depend on. Checking out the ~93000 game data files is most of what the job does, and ubuntu runners are quicker and cheaper at it. Naming the executable has to be exact now: the artifact is named after the matrix entry, which is lowercase, while the executable inside it is named after the CMake target, which is the uppercased application. Only NTFS was making those agree. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
166 lines
5.0 KiB
YAML
166 lines
5.0 KiB
YAML
name: release
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
tags:
|
|
- 'v*'
|
|
# allows to manually trigger a build
|
|
workflow_dispatch:
|
|
inputs:
|
|
assemble_release:
|
|
description: create release
|
|
required: false
|
|
default: false
|
|
type: boolean
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build:
|
|
uses: ./.github/workflows/build.yml
|
|
|
|
# only the game data differs per language, every package gets the same executables
|
|
assemble:
|
|
needs: build
|
|
# a manual run only assembles when asked for it. Otherwise every tag does,
|
|
# and master does in the upstream repository, which is the only one with
|
|
# somewhere to publish to
|
|
if: >-
|
|
${{ github.event_name == 'workflow_dispatch' && inputs.assemble_release
|
|
|| github.event_name != 'workflow_dispatch'
|
|
&& ( ( github.repository == '1dot13/source' && github.ref_name == 'master' )
|
|
|| startsWith(github.ref, 'refs/tags/v') ) }}
|
|
runs-on: ubuntu-latest
|
|
# at least English has to work
|
|
continue-on-error: ${{ matrix.language != 'English' }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
language: [Chinese, German, English, French, Polish, Italian, Dutch, Russian]
|
|
|
|
steps:
|
|
- name: Download versions.env
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
name: versions.env
|
|
path: artifacts
|
|
- name: Restore versions.env
|
|
shell: bash
|
|
run: cat artifacts/versions.env >> $GITHUB_ENV
|
|
|
|
# blob:none plus a sparse checkout fetches only the game data, not the
|
|
# engine source; both directories come from the same pinned commit
|
|
- name: Checkout gamedir and gamedir-languages
|
|
uses: actions/checkout@v7
|
|
with:
|
|
filter: 'blob:none'
|
|
sparse-checkout: |
|
|
gamedir
|
|
gamedir-languages
|
|
|
|
- name: Copy gamedir-languages files to gamedir
|
|
if: matrix.language != 'English'
|
|
shell: bash
|
|
run: |
|
|
set -eux
|
|
cp -a gamedir-languages/${{ matrix.language }}_Version/* gamedir/
|
|
|
|
- name: Download applications
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
pattern: ja2*
|
|
path: artifacts
|
|
|
|
- name: Copy application files to gamedir
|
|
shell: bash
|
|
run: |
|
|
set -eux
|
|
for APP in ja2 ja2mapeditor ja2ub ja2ubmapeditor
|
|
do
|
|
mv artifacts/${APP}/${APP^^}.exe gamedir/${APP}.exe
|
|
done
|
|
|
|
- name: Create version information file
|
|
shell: bash
|
|
run: |
|
|
set -eux
|
|
|
|
# "-" separates words, "_" combines words, see double-click behavior
|
|
DIST_PREFIX='JA2_113'
|
|
DIST_NAME="${DIST_PREFIX}-${GAME_VERSION}-${{ matrix.language }}"
|
|
echo "DIST_NAME=$DIST_NAME" >> $GITHUB_ENV
|
|
|
|
echo "If you encounter problems during gameplay, please provide the following version information:
|
|
Distribution Name: $DIST_NAME
|
|
Game Version: $GAME_VERSION
|
|
Language: ${{ matrix.language }}
|
|
Build Information: $GAME_BUILD_INFORMATION
|
|
Source Repository: $GITHUB_REPOSITORY
|
|
Source Commit SHA: $GITHUB_SHA
|
|
Source Commit Date: $SOURCE_COMMIT_DATETIME
|
|
" > "gamedir/${DIST_PREFIX}-Version.txt"
|
|
cat "gamedir/${DIST_PREFIX}-Version.txt"
|
|
|
|
- name: Create release archive
|
|
shell: bash
|
|
run: |
|
|
set -eux
|
|
mkdir dist/
|
|
cd gamedir/
|
|
7z a -bb -xr'!.*' "../dist/${DIST_NAME}.7z" .
|
|
|
|
- name: Upload
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: ${{ matrix.language }}_release
|
|
path: dist/
|
|
compression-level: 0
|
|
|
|
# a skipped assemble skips this too, so it needs no condition of its own
|
|
release:
|
|
needs: assemble
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
path: dist
|
|
pattern: '*_release'
|
|
merge-multiple: true
|
|
|
|
- name: Checkout Repo
|
|
uses: actions/checkout@v7
|
|
with:
|
|
path: source
|
|
fetch-depth: 1
|
|
sparse-checkout: 'README.md'
|
|
- name: Create latest pre-release
|
|
if: github.ref == 'refs/heads/master'
|
|
working-directory: source
|
|
run: |
|
|
gh release delete latest --cleanup-tag || true
|
|
git tag -d latest || true
|
|
git push --delete origin refs/tags/latest || true
|
|
git tag latest
|
|
git push --force origin refs/tags/latest
|
|
sleep 15 # make sure github can find the tag for gh release
|
|
gh release create latest ../dist/* \
|
|
--generate-notes \
|
|
--title "Latest (unstable)" \
|
|
--verify-tag \
|
|
--prerelease
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Upload to tagged release
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
working-directory: source
|
|
run: |
|
|
gh release upload "$GITHUB_REF_NAME" ../dist/* --clobber
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|