Skip to content

Commit

Permalink
add GameOriginalImagePack.mod.zip
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyoko-Jeremie committed Nov 15, 2023
1 parent 7ed4402 commit 9640320
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/Build-Html-Package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,42 @@ jobs:
destBase: ${{ github.workspace }}/ModLoader/out
target: ${{ github.workspace }}/ModLoader/out

- name: Build GameOriginalImagePack
if: runner.os == 'Windows'
working-directory: ${{ github.workspace }}/ModLoader/mod/GameOriginalImagePack
run: |
yarn install
yarn run build:ts
yarn run build:webpack
# copy game img , change boot.json GameVersion
- name: Copy img (Win)
if: runner.os == 'Windows'
working-directory: ${{ github.workspace }}/ModLoader/mod/GameOriginalImagePack
run: copy -Path "${{ github.workspace }}/DoL/img" -Destination "${{ github.workspace }}/ModLoader/mod/GameOriginalImagePack" -Recurse
- name: ReadGameVersion
id: ReadGameVersion
working-directory: ${{ github.workspace }}
run: |
node "${{ github.workspace }}/readGameVersion.js "${{ github.workspace }}/DOL/game/01-config/sugarcubeConfig.js"
# now we get the ${{ steps.ReadGameVersion.outputs.GameVersionString }}
- name: Build GameOriginalImagePack
if: runner.os == 'Windows'
working-directory: ${{ github.workspace }}/ModLoader/mod/GameOriginalImagePack
run: |
node "${{ github.workspace }}/ModLoader/mod/GameOriginalImagePack/dist-tools/bootJsonFillTool.js" "boot.json" "img" "${{ steps.ReadGameVersion.outputs.GameVersionString }}"
node "${{ github.workspace }}/ModLoader/dist-insertTools/packModZip.js" "boot.json"
- name: MKDIR
run: |
mkdir ${{ github.workspace }}/out-GameOriginalImagePack
- name: Copy GameOriginalImagePack
if: runner.os == 'Windows'
uses: Lyoko-Jeremie/js-copy-github-action@master
with:
srcBase: ${{ github.workspace }}/ModLoader/
source: ${{ github.workspace }}/ModLoader/mod/GameOriginalImagePack/GameOriginalImagePack.mod.zip
destBase: ${{ github.workspace }}/out-GameOriginalImagePack
target: ${{ github.workspace }}/out-GameOriginalImagePack

- name: Copy dist-BeforeSC2
uses: Lyoko-Jeremie/js-copy-github-action@master
with:
Expand Down Expand Up @@ -404,6 +440,12 @@ jobs:

# make package OK =========================================

- name: Upload GameOriginalImagePack.mod.zip
uses: actions/upload-artifact@v3
with:
name: GameOriginalImagePack-mod-${{ github.sha }}
path: ${{ github.workspace }}/out-GameOriginalImagePack/GameOriginalImagePack.mod.zip

- name: Upload
uses: actions/upload-artifact@v3
with:
Expand Down
46 changes: 46 additions & 0 deletions readGameVersion.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
const os = require("os")
const fs = require("fs")

function setOutput(key, value) {
// Temporary hack until core actions library catches up with github new recommendations
const output = process.env['GITHUB_OUTPUT']
fs.appendFileSync(output, `${key}=${value}${os.EOL}`)
}

;(async () => {
// game/01-config/sugarcubeConfig.js

console.log('process.argv.length', process.argv.length);
console.log('process.argv', process.argv);
const GameSugarCubeConfigJsFilePath = process.argv[2];
console.log('GameSugarCubeConfigJsFilePath', GameSugarCubeConfigJsFilePath);
if (!GameSugarCubeConfigJsFilePath) {
console.error('no GameSugarCubeConfigJsFilePath');
process.exit(1);
return;
}
const GameSugarCubeConfigJsF = await promisify(readFile)(GameSugarCubeConfigJsFilePath, {encoding: 'utf-8'});

const findR = GameSugarCubeConfigJsF.exec(/version: {0,}"([^"]+)"/);
if (!findR) {
console.error('cannot find version reg');
process.exit(1);
return;
}

const version = findR[1];
if (!version) {
console.error('cannot find version string');
process.exit(1);
return;
}
console.log('GameVersionString:', version);

setOutput("GameVersionString", version);

process.exit(0);
})().catch(E => {
console.error(E);
process.exit(1);
});

0 comments on commit 9640320

Please sign in to comment.