Skip to content

Add updated build script #239

Add updated build script

Add updated build script #239

Workflow file for this run

name: build
on:
push:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
platform: [windows, macos, linux]
archive-ref: [main]
steps:
- uses: actions/checkout@v4
- name: Read Versions
run: |
HKV=$(cat ./hollowknight.version)
echo "HK_VERSION=$HKV" >> $GITHUB_ENV
- name: Checkout Binaries
uses: actions/checkout@v4
with:
repository: hk-modding/hk-binary-archives
ref: ${{ matrix.archive-ref }}
ssh-key: ${{ secrets.BINARY_ARCHIVE_DEPLOY_KEY }}
sparse-checkout: |
${{ env.HK_VERSION }}/managed.${{ matrix.platform }}.tar.gz
sparse-checkout-cone-mode: false
path: ./hk-binary-archives
- name: Unpack Archive
run: |
mkdir Vanilla
cd ./Vanilla
tar -xzf ../hk-binary-archives/${{ env.HK_VERSION }}/managed.${{ matrix.platform }}.tar.gz
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
- name: Setup MSBuild
run: |
sudo apt-get update -y
sudo apt-get install -y nuget mono-devel mono-xbuild
- name: Restore Dependencies
run: |
dotnet restore
- name: Build PrePatcher
run: |
dotnet build PrePatcher -o PrePatcher/Output -p:Configuration=Release
- name: Build Assembly-CSharp
run: |
dotnet build Assembly-CSharp -p:SolutionDir=$PWD -p:Configuration=Release
- name: Upload Binary
uses: actions/upload-artifact@v4
with:
name: build.${{ matrix.platform }}
path: ./OutputFinal/
release:
needs: [build]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags')
steps:
- name: Read Versions
run: |
HKV=$(cat ./hollowknight.version)
echo "HK_VERSION=$HKV" >> $GITHUB_ENV
APIV=$(cat ./moddingapi.version)
echo "API_VERSION=$APIV" >> $GITHUB_ENV
- uses: actions/download-artifact@v4
with:
path: ./artifacts
- name: Zip Artifacts
run: |
zip -jr moddingapi.${{ env.API_VERSION }}.windows.zip ./artifacts/build.windows/*
zip -jr moddingapi.${{ env.API_VERSION }}.macos.zip ./artifacts/build.macos/*
zip -jr moddingapi.${{ env.API_VERSION }}.linux.zip ./artifacts/build.linux/*
- uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Install Node Dependencies
run: |
npm install handlebars
- name: Create Release Notes
id: create-relnotes
uses: actions/github-script@v7
env:
CHANGELOG: ${{ github.event.head_commit.message }}
with:
result-encoding: string
script: |
const script = require("./.github/workflows/create_relnotes.js");
return await script();
- name: Create Release
uses: softprops/action-gh-release@v2
with:
body: ${{ steps.create-relnotes.outputs.result }}
files: |
./moddingapi.${{ env.API_VERSION }}.windows.zip
./moddingapi.${{ env.API_VERSION }}.macos.zip
./moddingapi.${{ env.API_VERSION }}.linux.zip