Bump version number #25
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: build | |
on: | |
push: | |
paths: | |
- "**/*" | |
- "!.*" | |
- "!.github/**/*" | |
- "!README.md" | |
workflow_dispatch: | |
jobs: | |
assembling: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install NASM | |
uses: ilammy/setup-nasm@v1 | |
- name: Assemble injections | |
shell: cmd | |
run: make src/inc/injections.inc | |
- name: Cache intermediate build results | |
uses: actions/cache/save@v4 | |
with: | |
path: | | |
metadata | |
src | |
bin | |
key: intermediate1-${{ github.run_id }}-${{ github.run_attempt }} | |
resources: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout resource repository | |
uses: actions/checkout@v4 | |
with: | |
repository: szapp/NinjaScripts | |
submodules: recursive | |
token: ${{ secrets.NINJA_LEGO_TOKEN }} | |
persist-credentials: false | |
- name: Build resource data | |
uses: kirides/vdfsbuilder@aaf901f0c98245af54102a1946d8be0e2e17ba36 | |
with: | |
in: iklg.vm | |
out: iklg.data | |
ts: '2039-12-31 23:59:58' | |
- name: Move into the correct directory | |
run: | | |
mkdir -p src/inc | |
mv iklg.data src/inc | |
- name: Cache compiled resource data | |
uses: actions/cache/save@v4 | |
with: | |
path: src/inc/iklg.data | |
key: resources-${{ github.run_id }}-${{ github.run_attempt }} | |
linking: | |
runs-on: windows-latest | |
needs: [assembling, resources] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Fetch intermediate build results | |
uses: actions/cache/restore@v4 | |
with: | |
fail-on-cache-miss: true | |
path: | | |
metadata | |
src | |
bin | |
key: intermediate1-${{ github.run_id }}-${{ github.run_attempt }} | |
- name: Fetch compiled resource data | |
uses: actions/cache/restore@v4 | |
with: | |
fail-on-cache-miss: true | |
enableCrossOsArchive: true | |
path: src/inc/iklg.data | |
key: resources-${{ github.run_id }}-${{ github.run_attempt }} | |
- name: Install NASM | |
uses: ilammy/setup-nasm@v1 | |
- name: Download GoDevTools and Ducible | |
run: | | |
Invoke-WebRequest http://godevtool.com/Golink.zip -OutFile golink.zip | |
Invoke-WebRequest http://godevtool.com/Gorc.zip -OutFile gorc.zip | |
Invoke-WebRequest https://github.com/jasonwhite/ducible/releases/download/v1.2.2/ducible-windows-Win32-Release.zip -OutFile ducible.zip | |
unzip golink.zip GoLink.exe | |
unzip gorc.zip GoRC.exe | |
unzip ducible.zip ducible.exe | |
- name: Assemble Ninja.dll | |
shell: cmd | |
run: make build/Ninja.dll | |
- name: Assemble BugslayerUtil.dll | |
shell: cmd | |
run: make build/BugslayerUtil.dll | |
- name: Cache intermediate build results | |
uses: actions/cache/save@v4 | |
with: | |
# Cache all source files for make timestamps | |
path: | | |
metadata | |
LICENSE | |
src | |
bin | |
build | |
key: intermediate2-${{ github.run_id }}-${{ github.run_attempt }} | |
- name: Calculate checksum | |
run: | | |
$crc = crc32 build/Ninja.dll | |
echo "::notice title=Ninja.dll CRC32::0x$($crc.ToUpper())" | |
- name: Upload DLLs as workflow artifact | |
if: github.event_name == 'workflow_dispatch' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ninja | |
path: build/*.dll | |
setup: | |
runs-on: windows-latest | |
needs: linking | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Fetch intermediate build results | |
uses: actions/cache/restore@v4 | |
with: | |
fail-on-cache-miss: true | |
path: | | |
metadata | |
LICENSE | |
src | |
bin | |
build | |
key: intermediate2-${{ github.run_id }}-${{ github.run_attempt }} | |
- name: Build NSIS setup | |
shell: cmd | |
run: make all | |
- name: Cache build results | |
uses: actions/cache/save@v4 | |
with: | |
enableCrossOsArchive: true | |
path: build | |
key: results-${{ github.run_id }}-${{ github.run_attempt }} | |
- name: Export version | |
shell: bash | |
run: | | |
source metadata | |
echo "VERSION=$VBASE.$VMAJOR.$VMINOR" >> $GITHUB_ENV | |
- name: Calculate checksum | |
run: | | |
$sha = (Get-FileHash build/Ninja-${{ env.VERSION }}.exe).Hash | |
echo "::notice title=Ninja-${{ env.VERSION }}.exe SHA-256::$sha" | |
- name: Upload setup as workflow artifact | |
if: github.event_name == 'workflow_dispatch' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: setup | |
path: build/Ninja-*.exe | |
deploy: | |
runs-on: ubuntu-latest | |
needs: setup | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Fetch build results | |
uses: actions/cache/restore@v4 | |
with: | |
enableCrossOsArchive: true | |
fail-on-cache-miss: true | |
path: build | |
key: results-${{ github.run_id }}-${{ github.run_attempt }} | |
- name: Draft release | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
tag=${GITHUB_REF#refs/tags/} | |
changlogdate=$(date -d ${{ github.event.head_commit.timestamp }} +"%b-%-d-%Y") | |
changelogid="${tag//./}-${changlogdate,,}" | |
echo "VERSION=${tag/v/}" >> $GITHUB_ENV | |
echo "CHANGELOGID=${changelogid}" >> $GITHUB_ENV | |
notes="<!-- <div align=\"center\"><table width=\"100%\"><td><b>⚠ This version is outdated. Please use the <a href=\"https://github.com/szapp/Ninja/releases/latest\">lastest version</a> instead. ⚠ </b></td></table></div> -->"$'\n\n'"- [Change log](https://github.com/szapp/Ninja/wiki/Changelog#$changelogid)"$'\n'"- [Installation instructions](https://github.com/szapp/Ninja/wiki/Installation-(EN)#wiki-wrapper)"$'\n'"- [Check sums](https://github.com/szapp/Ninja/wiki/Checksums#wiki-wrapper)" | |
gh release create $tag -R ${{ github.repository }} -d --verify-tag --title "Ninja ${tag/v/}" --notes "$notes" build/Ninja-*.exe || echo "::error title=Release failed::Could not draft release for tag $tag" | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT }} | |
- name: Prepare Steam workshop upload | |
run: | | |
mkdir -p content/System | |
cp build/*.dll content/System/ | |
curl -sLO https://github.com/user-attachments/files/15592985/BugslayerUtilG.zip | |
unzip BugslayerUtilG.zip -d content/System/ | |
rm BugslayerUtilG.zip | |
- name: Update in Gothic 1 Steam workshop | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: m00nl1ght-dev/steam-workshop-deploy@v2 | |
with: | |
username: ${{ secrets.STEAM_USERNAME }} | |
configVdf: ${{ secrets.STEAM_CONFIG_VDF }} | |
path: content | |
appId: 65540 | |
publishedFileId: 2786936496 | |
changeNote: | | |
Version ${{ env.VERSION }} | |
https://github.com/szapp/Ninja/wiki/Changelog#${{ env.CHANGELOGID }} | |
- name: Update in Gothic 2 Steam workshop | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: m00nl1ght-dev/steam-workshop-deploy@v2 | |
with: | |
username: ${{ secrets.STEAM_USERNAME }} | |
configVdf: ${{ secrets.STEAM_CONFIG_VDF }} | |
path: content | |
appId: 39510 | |
publishedFileId: 2786910489 | |
changeNote: | | |
Version ${{ env.VERSION }} | |
https://github.com/szapp/Ninja/wiki/Changelog#${{ env.CHANGELOGID }} | |
cleanup: | |
runs-on: ubuntu-latest | |
needs: deploy | |
if: ${{ !cancelled() }} | |
permissions: | |
actions: write | |
steps: | |
- name: Clear cache | |
run: | | |
gh extension install actions/gh-actions-cache | |
gh actions-cache delete resources-${{ github.run_id }}-${{ github.run_attempt }} -R ${{ github.repository }} --confirm | |
gh actions-cache delete intermediate1-${{ github.run_id }}-${{ github.run_attempt }} -R ${{ github.repository }} --confirm | |
gh actions-cache delete intermediate2-${{ github.run_id }}-${{ github.run_attempt }} -R ${{ github.repository }} --confirm | |
gh actions-cache delete results-${{ github.run_id }}-${{ github.run_attempt }} -R ${{ github.repository }} --confirm | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |