97 lines
2.9 KiB
YAML
97 lines
2.9 KiB
YAML
name: Build and Update Repo
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- '*'
|
|
|
|
env:
|
|
PLUGIN_NAME: ClubPenguinSync
|
|
DOTNET_VERSION: 9.x
|
|
|
|
jobs:
|
|
build-and-update-repo:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
|
|
steps:
|
|
- name: Checkout Club Penguin
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
submodules: true
|
|
|
|
- name: Setup .NET 9 SDK
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: 9.x
|
|
|
|
- name: Download Dalamud
|
|
run: |
|
|
cd /
|
|
mkdir -p ~/.xlcore/dalamud/Hooks/dev
|
|
curl -O https://goatcorp.github.io/dalamud-distrib/stg/latest.zip
|
|
unzip latest.zip -d ~/.xlcore/dalamud/Hooks/dev
|
|
|
|
- name: Build Club Penguin
|
|
run: |
|
|
dotnet restore
|
|
dotnet build --configuration Release --no-restore
|
|
|
|
- name: Prepare Club Penguin Repo
|
|
run: |
|
|
mkdir -p output
|
|
mv MareSynchronos/bin/x64/Release/ClubPenguinSync/latest.zip /repo/download/ClubPenguinSync-${{ gitea.ref_name }}.zip
|
|
|
|
- name: Update repo.json with version
|
|
env:
|
|
VERSION: ${{ gitea.ref_name }}
|
|
run: |
|
|
set -e
|
|
|
|
pluginJsonPath="MareSynchronos/bin/x64/Release/${PLUGIN_NAME}.json"
|
|
repoJsonPath="/repo/repo.json"
|
|
version="${VERSION}"
|
|
downloadUrl="https://clubpenguin.drgn.rocks/download/ClubPenguinSync-${{ gitea.ref_name }}.zip"
|
|
|
|
# Read plugin JSON
|
|
pluginJson=$(cat "$pluginJsonPath")
|
|
internalName=$(jq -r '.InternalName' <<< "$pluginJson")
|
|
dalamudApiLevel=$(jq -r '.DalamudApiLevel' <<< "$pluginJson")
|
|
|
|
# Read repo JSON (force array if not already)
|
|
repoJsonRaw=$(cat "$repoJsonPath")
|
|
if echo "$repoJsonRaw" | jq 'type' | grep -q '"array"'; then
|
|
repoJson="$repoJsonRaw"
|
|
else
|
|
repoJson="[$repoJsonRaw]"
|
|
fi
|
|
|
|
# Update matching plugin entry
|
|
updatedRepoJson=$(jq \
|
|
--arg internalName "$internalName" \
|
|
--arg dalamudApiLevel "$dalamudApiLevel" \
|
|
--arg version "$version" \
|
|
--arg downloadUrl "$downloadUrl" \
|
|
'
|
|
map(
|
|
if .InternalName == $internalName
|
|
then
|
|
.DalamudApiLevel = $dalamudApiLevel
|
|
| .TestingDalamudApiLevel = $dalamudApiLevel
|
|
| .AssemblyVersion = $version
|
|
| .TestingAssemblyVersion = $version
|
|
| .DownloadLinkInstall = $downloadUrl
|
|
| .DownloadLinkTesting = $downloadUrl
|
|
| .DownloadLinkUpdate = $downloadUrl
|
|
else
|
|
.
|
|
end
|
|
)
|
|
' <<< "$repoJson")
|
|
|
|
# Write back to file
|
|
echo "$updatedRepoJson" > "$repoJsonPath"
|
|
# Output the content of the file
|
|
cat "$repoJsonPath" |