Skip to content

Build Release

Build Release #779

Workflow file for this run

name: Build Release
on:
schedule:
- cron: '0 0 * * *'
push:
branches:
- "main"
paths-ignore:
- '*.yaml'
- '*.txt'
- '*.md'
workflow_dispatch:
inputs:
version:
description: 'Release version (defaults to "Nightly" & always appends run ID)'
required: false
default: 'Nightly'
publish-release:
description: 'Publish Release?'
type: boolean
default: true
release-body:
description: 'Release body'
required: false
default: 'Latest nightly of QuickLootIE. These builds are untested and may contain bugs.'
spriggit_tool_version:
description: 'Spriggit version (optional)'
required: false
jobs:
prepare:
name: Prepare and Check Changes
runs-on: ubuntu-latest
outputs:
date: ${{ steps.get-date.outputs.time }}
version: ${{ steps.get-version.outputs.VERSION }}
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Get Date
id: get-date
uses: Kaven-Universe/github-action-current-date-time@v1
with:
format: "YYYY-MM-DD"
- name: Get version
id: get-version
shell: bash
run: echo "VERSION=${{ inputs.version || format('nightly-{0}', steps.get-date.outputs.time) }}" >> "$GITHUB_OUTPUT"
- name: Check for changes last 24 hours
id: should_run
shell: bash
run: |
git log --since="1 days ago" --name-only
echo "should_run=$(git log --since="1 days ago" --name-only | grep "" -c)" >> "$GITHUB_OUTPUT"
build-plugin:
name: Build ESP from Spriggit files
needs: prepare
if: ${{ needs.prepare.outputs.should_run >= 1 || github.event_name == 'workflow_dispatch' && always() }}
permissions: write-all
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create Pack Folder
run: mkdir -p $env:GITHUB_WORKSPACE\\to-pack
shell: pwsh
- name: Cache Spriggit
id: cache-spriggit
uses: actions/cache@v4
with:
path: .github/spriggit
key: ${{ runner.os }}-spriggit-${{ inputs.spriggit_tool_version }}
- name: Fetch Spriggit
if: steps.cache-spriggit.outputs.cache-hit != 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release download -R Mutagen-Modding/Spriggit --pattern "SpriggitCLI.zip" --dir .github
7z x .github/SpriggitCLI.zip -o".github/spriggit/"
if (Test-Path ".github/spriggit/Spriggit.CLI.exe") {
Write-Host "Spriggit.CLI.exe found and ready."
} else {
Write-Error "Spriggit.CLI.exe not found! Exiting."
exit 1
}
shell: pwsh
- name: Run Spriggit
run: .github\spriggit\Spriggit.CLI.exe deserialize --InputPath "res/esp" --OutputPath "res/esp/QuickLootIE.esp"
shell: cmd
- name: Upload Plugin Artifact
uses: actions/upload-artifact@v4
with:
name: plugin
path: res/esp/QuickLootIE.esp
compile-scripts:
name: Compile Papyrus scripts
needs: prepare
if: ${{ needs.prepare.outputs.should_run >= 1 || github.event_name == 'workflow_dispatch' && always() }}
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache Script Sources
id: cache-ss
uses: actions/cache@v4
with:
path: |
.github/Papyrus/SRC
.github/Papyrus/SRC_SKYUI
.github/Papyrus/SRC_PAPUTIL
.github/Papyrus/SRC/TESV_Papyrus_Flags.flg
key: script-sources-clean
- name: Cache Compiler
id: cache-com
uses: actions/cache@v4
with:
path: .github/Caprica
key: ${{ runner.os }}-papyrus-compiler
- name: Fetch Caprica 0.3.0
if: steps.cache-com.outputs.cache-hit != 'true'
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
gh release download -O .github/Caprica.7z -p '*.7z' -R Orvid/Caprica v0.3.0
7z x .github/Caprica.7z "-o.github\Caprica"
- name: Checkout Papyrus Sources
if: steps.cache-ss.outputs.cache-hit != 'true'
run: |
mkdir .github/Papyrus
$repos = @("SRC", "SRC_SKYUI", "SRC_PAPUTIL")
Set-Location .github/Papyrus
foreach ($repo in $repos) {
New-Item -ItemType Directory -Name $repo
Set-Location $repo
git init
git remote add origin https://github.com/IHateMyKite/PAPYRUS.git
git sparse-checkout set --no-cone $repo
git fetch --depth=1 origin main
git checkout main
Remove-Item .git -Recurse -Force
Set-Location ..
}
- name: Checkout TESV Flags File
if: steps.cache-ss.outputs.cache-hit != 'true'
run: |
cd .github/Papyrus/SRC
mkdir temp
cd temp
git init
git remote add origin https://github.com/Rukan/Grimy-Skyrim-Papyrus-Source.git
git sparse-checkout set --no-cone 'TESV_Papyrus_Flags.flg'
git fetch --depth=1 origin master
git checkout master
Remove-Item .git -Recurse -Force
mv TESV_Papyrus_Flags.flg ../TESV_Papyrus_Flags.flg
Set-Location ..
Remove-Item temp -Recurse -Force
- name: Run Caprica
run: .github/Caprica/Caprica.exe --game skyrim --import ".github/Papyrus/SRC;.github/Papyrus/SRC_SKYUI;.github/Papyrus/SRC_PAPUTIL;" --output "res/pex/Scripts" --flags=".github/Papyrus/SRC/TESV_Papyrus_Flags.flg" "${{ github.workspace }}/res/pex/Source/Scripts" -R -q
- name: Upload Compiled Scripts Artifact
uses: actions/upload-artifact@v4
with:
name: compiled-scripts
path: res/pex/Scripts
compile-skse:
needs: prepare
if: ${{ needs.prepare.outputs.should_run >= 1 || github.event_name == 'workflow_dispatch' && always() }}
runs-on: windows-latest
steps:
- name: Recursive Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set xmake env
run: echo "XMAKE_GLOBALDIR=${{ runner.workspace }}/xmake-global" >> $GITHUB_ENV
- name: Create xmake cache directories
run: |
mkdir -p ${{ env.XMAKE_GLOBALDIR }}/xmake-cache
mkdir -p ${{ env.XMAKE_GLOBALDIR }}/build-cache
- name: Cache xmake dependencies
uses: actions/cache@v4
with:
path: |
~/.xmake/packages
${{ env.XMAKE_GLOBALDIR }}/xmake-cache
key: xmake-deps-${{ runner.os }}-${{ hashFiles('xmake-require.lock') }}
restore-keys: |
xmake-deps-${{ runner.os }}-
- name: Cache xmake build cache
uses: actions/cache@v4
with:
path: ${{ env.XMAKE_GLOBALDIR }}/build-cache
key: xmake-build-${{ runner.os }}-${{ github.sha }}
restore-keys: |
xmake-build-${{ runner.os }}-
- name: Setup xmake
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: 'latest'
actions-cache-folder: ${{ env.XMAKE_GLOBALDIR }}/xmake-cache
actions-cache-key: '.xmake-actions-cache'
build-cache: true
build-cache-path: ${{ env.XMAKE_GLOBALDIR }}/build-cache
build-cache-key: xmake-build-${{ runner.os }}-${{ github.run_id }}
- name: Install dependencies
run: |
xmake repo --update
xmake require -y
- name: Compile SKSE plugin
run: xmake
- name: Verify output files
run: dir "${{ github.workspace }}/build/windows/x64/release"
- name: Upload SKSE Plugin Artifact
uses: actions/upload-artifact@v4
with:
name: skse-plugin
path: |
${{ github.workspace }}/build/windows/x64/release/QuickLootIE.dll
${{ github.workspace }}/build/windows/x64/release/QuickLootIE.pdb
package-mod:
name: Package all necessary files
runs-on: ubuntu-latest
needs: [build-plugin, compile-scripts, compile-skse, prepare]
if: ${{ needs.prepare.outputs.should_run >= 1 || github.event_name == 'workflow_dispatch' && always() }}
steps:
- name: Recursive Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: plugin
path: res/esp
- name: Download Compiled Scripts Artifact
uses: actions/download-artifact@v4
with:
name: compiled-scripts
path: res/pex/Scripts
- name: Download SKSE Plugin Artifact
uses: actions/download-artifact@v4
with:
name: skse-plugin
path: res/dll/SKSE/Plugins
- name: Create Release and Dev SDK Folders
run: |
mkdir -p "${{ github.workspace }}/to-pack/Source/Scripts"
mkdir -p "${{ github.workspace }}/to-pack/SKSE/Plugins"
mkdir -p "${{ github.workspace }}/to-pack/Interface"
mkdir -p "${{ github.workspace }}/to-pack/Scripts"
mkdir -p "${{ github.workspace }}/pack-dev/Interface"
mkdir -p "${{ github.workspace }}/pack-dev/LootMenuIE"
mkdir -p "${{ github.workspace }}/pack-dev/external"
mkdir -p "${{ github.workspace }}/pack-dev/include"
cp -a "LICENSE" "${{ github.workspace }}/to-pack/QLIE-LICENSE.md"
cp -a "res/dll/SKSE/Plugins/." "${{ github.workspace }}/to-pack/SKSE/Plugins"
cp -a "res/esp/QuickLootIE.esp" "${{ github.workspace }}/to-pack/QuickLootIE.esp"
cp -a "res/pex/Scripts/." "${{ github.workspace }}/to-pack/Scripts"
cp -a "res/pex/Source/Scripts/." "${{ github.workspace }}/to-pack/Source/Scripts"
cp -a "res/txt/Interface/." "${{ github.workspace }}/to-pack/Interface"
cp -a "res/swf/Interface/." "${{ github.workspace }}/to-pack/Interface"
cp -a "res/QuickLootIE.json" "${{ github.workspace }}/to-pack/SKSE/Plugins/QuickLootIE.json"
cp -a "LICENSE" "${{ github.workspace }}/pack-dev/QLIE-LICENSE.md"
cp -a "res/swf/Interface/LootMenuIE.swf" "${{ github.workspace }}/pack-dev/Interface"
cp -a "res/swf/Source/." "${{ github.workspace }}/pack-dev/LootMenuIE"
cp -a "include/." "${{ github.workspace }}/pack-dev/include"
cp -a "extern/CommonLibSSE-NG/Flash/." "${{ github.workspace }}/pack-dev/external"
- name: Zip Release Files
uses: vimtor/action-zip@v1.2
with:
files: to-pack/.
dest: QuickLootIE-${{ needs.prepare.outputs.version }}.zip
- name: Zip Dev SDK Files
uses: vimtor/action-zip@v1.2
with:
files: pack-dev/.
dest: QuickLootIE-DevSDK-${{ needs.prepare.outputs.version }}.zip
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: QuickLootIE-${{ needs.prepare.outputs.version }}
path: QuickLootIE-${{ needs.prepare.outputs.version }}.zip
- name: Upload Dev SDK Artifact
uses: actions/upload-artifact@v4
with:
name: QuickLootIE-DevSDK-${{ needs.prepare.outputs.version }}
path: QuickLootIE-DevSDK-${{ needs.prepare.outputs.version }}.zip
- name: Remove Temporary Artifacts
uses: geekyeggo/delete-artifact@v4
with:
name: |
plugin
skse-plugin
compiled-scripts
share-release:
name: Share release
needs: [package-mod, prepare]
if: ${{ inputs.publish-release == true && (needs.prepare.outputs.should_run >= 1 || github.event_name == 'workflow_dispatch' && always()) }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Release Artifact
uses: actions/download-artifact@v4
with:
name: QuickLootIE-${{ needs.prepare.outputs.version }}
- name: Download Dev SDK Artifact
uses: actions/download-artifact@v4
with:
name: QuickLootIE-DevSDK-${{ needs.prepare.outputs.version }}
- name: Delete Existing Release
uses: dev-drprasad/delete-tag-and-release@v1.0
with:
tag_name: ${{ needs.prepare.outputs.version }}
github_token: ${{ github.token }}
delete_release: true
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1.13.0
env:
GITHUB_TOKEN: ${{ github.token }}
with:
allowUpdates: true
name: QuickLootIE-${{ needs.prepare.outputs.version }} @ ${{ needs.prepare.outputs.date }}
draft: false
body: ${{ inputs.release-body }}
tag: ${{ needs.prepare.outputs.version }}
prerelease: true
makeLatest: false
removeArtifacts: true
replacesArtifacts: true
artifactErrorsFailBuild: true
artifacts: |
QuickLootIE-${{ needs.prepare.outputs.version }}.zip
QuickLootIE-DevSDK-${{ needs.prepare.outputs.version }}.zip
- name: Remove Temporary Artifacts
uses: geekyeggo/delete-artifact@v2
with:
name: |
QuickLootIE-${{ needs.prepare.outputs.version }}.zip
QuickLootIE-DevSDK-${{ needs.prepare.outputs.version }}.zip
failOnError: false