Add unofficial builds

This commit is contained in:
Asriel Camora
2023-11-01 20:07:07 -07:00
parent 256a72db88
commit 239f71db58
2 changed files with 34 additions and 2 deletions
+27
View File
@@ -0,0 +1,27 @@
import shutil, os, subprocess, zipfile, json, sys
from itertools import chain
PROJECT_NAME = sys.argv[1]
OFFICIAL_ZIP = f"{PROJECT_NAME}/bin/x64/Release/{PROJECT_NAME}/latest.zip"
UNOFFICIAL_ZIP = f"{PROJECT_NAME}/bin/x64/Release/{PROJECT_NAME}/latestUnofficial.zip"
shutil.copy(OFFICIAL_ZIP, UNOFFICIAL_ZIP)
subprocess.check_call(['7z', 'd', UNOFFICIAL_ZIP, f"{PROJECT_NAME}.json"])
with zipfile.ZipFile(UNOFFICIAL_ZIP) as file:
members = file.namelist()
subprocess.check_call(['7z', 'rn', UNOFFICIAL_ZIP] + list(chain.from_iterable((m, m.replace(PROJECT_NAME, f"{PROJECT_NAME}Unofficial")) for m in members)))
with open(f"{PROJECT_NAME}/bin/x64/Release/{PROJECT_NAME}/{PROJECT_NAME}.json") as file:
manifest = json.load(file)
manifest['Punchline'] = f"Unofficial/uncertified build of {manifest['Name']}. {manifest['Punchline']}"
manifest['InternalName'] += 'Unofficial'
manifest['Name'] += ' (Unofficial)'
manifest['IconUrl'] = f"https://raw.githubusercontent.com/WorkingRobot/MyDalamudPlugins/main/icons/{manifest['InternalName']}.png"
with zipfile.ZipFile(UNOFFICIAL_ZIP, "a", zipfile.ZIP_DEFLATED, compresslevel = 7) as file:
file.writestr(f"{PROJECT_NAME}Unofficial.json", json.dumps(manifest, indent = 2))
+7 -2
View File
@@ -6,6 +6,7 @@ on:
env: env:
PLUGIN_REPO: WorkingRobot/MyDalamudPlugins PLUGIN_REPO: WorkingRobot/MyDalamudPlugins
PROJECT_NAME: Craftimizer PROJECT_NAME: Craftimizer
IS_OFFICIAL: ${{true}}
jobs: jobs:
build: build:
@@ -32,7 +33,7 @@ jobs:
- name: Restore - name: Restore
run: | run: |
dotnet restore -r win ${{env.PROJECT_NAME}}.sln dotnet restore -r win
- name: Build - name: Build
run: | run: |
@@ -42,6 +43,10 @@ jobs:
run: | run: |
dotnet test --configuration Release --logger "trx;logfilename=results.trx" --logger "html;logfilename=results.html" --logger "console;verbosity=detailed" --no-build --results-directory="TestResults" dotnet test --configuration Release --logger "trx;logfilename=results.trx" --logger "html;logfilename=results.html" --logger "console;verbosity=detailed" --no-build --results-directory="TestResults"
- name: Create Unofficial Builds
if: ${{env.IS_OFFICIAL}}
run: python ./.github/create_unofficial.py ${{env.PROJECT_NAME}}
- name: Upload Artifacts - name: Upload Artifacts
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
@@ -51,7 +56,7 @@ jobs:
- name: Upload Test Results - name: Upload Test Results
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
if: ${{ always() }} if: ${{ !cancelled() }}
with: with:
name: TestResults name: TestResults
path: TestResults path: TestResults