diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ea65559b8..dcd244521 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -63,37 +63,47 @@ jobs: name: sourcemap path: | xmcl-electron-app/dist/*.js.map - - name: Upload Build + - name: Upload Unsigned Appx + if: ${{ runner.os == 'Windows' && startsWith(github.event.head_commit.message, 'chore(release)') }} id: upload-artifact uses: actions/upload-artifact@v4 with: - name: build-${{ runner.os }} + name: appx path: | - xmcl-electron-app/build/output/ + xmcl-electron-app/build/output/*.appx - name: Sign Build if: ${{ runner.os == 'Windows' && startsWith(github.event.head_commit.message, 'chore(release)') }} + id: sign uses: signpath/github-action-submit-signing-request@v0.4 + continue-on-error: true with: api-token: ${{ secrets.CODE_SIGN_TOKEN }} organization-id: ab51b40d-a5bd-4d25-ae54-66ccabf86161 project-slug: x-minecraft-launcher signing-policy-slug: release-signing github-artifact-id: ${{ steps.upload-artifact.outputs.artifact-id }} - artifact-configuration-slug: build + artifact-configuration-slug: appx wait-for-completion: true output-artifact-directory: xmcl-electron-app/build/output/ + - name: Check Sign Status + id: sign-status + if: ${{ runner.os == 'Windows' && startsWith(github.event.head_commit.message, 'chore(release)') }} + run: | + if ("${{ steps.sign.outcome }}" -eq "success") { + echo "SIGN_SUCCESS=true" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + } else { + echo "SIGN_SUCCESS=false" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + } - name: Update Signed Sha256 if: ${{ runner.os == 'Windows' && startsWith(github.event.head_commit.message, 'chore(release)') }} run: | pnpm postsign - - name: Upload Signed Build - if: ${{ runner.os == 'Windows' && startsWith(github.event.head_commit.message, 'chore(release)') }} + - name: Upload Build uses: actions/upload-artifact@v4 with: name: build-${{ runner.os }} path: | xmcl-electron-app/build/output/ - overwrite: true - name: Upload Windows Zip Build if: ${{ runner.os == 'Windows' }} uses: actions/upload-artifact@v4 diff --git a/package.json b/package.json index f4f99a0a2..aac935ee6 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.47.4", + "version": "0.47.5", "private": true, "license": "MIT", "packageManager": "pnpm@9.3.0", diff --git a/xmcl-electron-app/package.json b/xmcl-electron-app/package.json index b62f8c746..6e526513a 100644 --- a/xmcl-electron-app/package.json +++ b/xmcl-electron-app/package.json @@ -2,7 +2,7 @@ "name": "xmcl", "private": true, "main": "./index.js", - "version": "0.47.4", + "version": "0.47.5", "author": "ci010 ", "description": "A great minecraft launcher in the future", "license": "MIT", diff --git a/xmcl-electron-app/postsign.ts b/xmcl-electron-app/postsign.ts index ca2ba1e89..1d6340b75 100644 --- a/xmcl-electron-app/postsign.ts +++ b/xmcl-electron-app/postsign.ts @@ -1,15 +1,25 @@ -import { readdirSync, readFileSync, writeFileSync } from 'fs' +import { readdirSync, readFileSync, writeFileSync, unlinkSync } from 'fs' import { createHash } from 'crypto' +const success = process.env.SIGN_SUCCESS -const files = readdirSync('./build/output') -const toUpdate = files.filter((file) => file.endsWith('.appx') || file.endsWith('.zip')) +if (success) { + const files = readdirSync('./build/output') + const toUpdate = files.filter((file) => file.endsWith('.appx') || file.endsWith('.zip')) -for (const file of toUpdate) { - const hash = createHash('sha256') - const content = readFileSync(`./build/output/${file}`) - hash.update(content) - const digest = hash.digest('hex') - const sha256File = `./build/output/${file}.sha256` - writeFileSync(sha256File, digest) - console.log(`Wrote sha256 hash to ${file} -> ${sha256File} = ${digest}`) + for (const file of toUpdate) { + const hash = createHash('sha256') + const content = readFileSync(`./build/output/${file}`) + hash.update(content) + const digest = hash.digest('hex') + const sha256File = `./build/output/${file}.sha256` + writeFileSync(sha256File, digest) + console.log(`Wrote sha256 hash to ${file} -> ${sha256File} = ${digest}`) + } +} else { + // remove appx + const files = readdirSync('./build/output') + const toDelete = files.filter((file) => file.endsWith('.appx') || file.endsWith('.appinstaller')) + for (const f of toDelete) { + unlinkSync(`./build/output/${f}`) + } } diff --git a/xmcl-keystone-ui/package.json b/xmcl-keystone-ui/package.json index 86f1b25c5..796d9d00a 100644 --- a/xmcl-keystone-ui/package.json +++ b/xmcl-keystone-ui/package.json @@ -3,7 +3,7 @@ "private": true, "type": "module", "productName": "xmcl", - "version": "0.46.1", + "version": "0.46.2", "author": "ci010 ", "description": "A great minecraft launcher in the future", "license": "MIT", diff --git a/xmcl-runtime/package.json b/xmcl-runtime/package.json index 37907e74b..f54433e37 100644 --- a/xmcl-runtime/package.json +++ b/xmcl-runtime/package.json @@ -1,7 +1,7 @@ { "name": "@xmcl/runtime", "private": true, - "version": "0.44.4", + "version": "0.44.5", "author": "ci010 ", "description": "The runtime for x minecraft launcher in nodejs", "license": "MIT",