CI: move Generate manifest keys into JS part
This commit is contained in:
parent
6720f43298
commit
8afa083b39
10
.github/workflows/release.yml
vendored
10
.github/workflows/release.yml
vendored
@ -39,15 +39,6 @@ jobs:
|
||||
- name: Create archive
|
||||
run: zip -j "intro-skipper-v${{ env.NEW_FILE_VERSION }}.zip" ConfusedPolarBear.Plugin.IntroSkipper/bin/Debug/net8.0/ConfusedPolarBear.Plugin.IntroSkipper.dll
|
||||
|
||||
- name: Generate manifest keys
|
||||
run: |
|
||||
sourceUrl="https://github.com/${{ github.repository }}/releases/download/10.9/v${{ env.NEW_FILE_VERSION }}/intro-skipper-v${{ env.NEW_FILE_VERSION }}.zip"
|
||||
echo "SOURCE_URL=$sourceUrl" >> $GITHUB_ENV
|
||||
md5sum intro-skipper-v${{ env.NEW_FILE_VERSION }}.zip > intro-skipper-v${{ env.NEW_FILE_VERSION }}.md5
|
||||
checksum="$(awk '{print $1}' intro-skipper-v${{ env.NEW_FILE_VERSION }}.md5)"
|
||||
echo "CHECKSUM=$checksum" >> $GITHUB_ENV
|
||||
timestamp="$(date +%FT%TZ)"
|
||||
echo "TIMESTAMP=$timestamp" >> $GITHUB_ENV
|
||||
|
||||
- name: Create new release with tag
|
||||
if: github.event_name != 'pull_request'
|
||||
@ -59,6 +50,7 @@ jobs:
|
||||
run: node validate-and-update-manifest.js
|
||||
env:
|
||||
VERSION: ${{ env.NEW_FILE_VERSION }}
|
||||
GITHUB_REPOSITORY: ${{ github.repository }}
|
||||
|
||||
- name: Commit changes
|
||||
if: success()
|
||||
|
@ -3,6 +3,10 @@ const crypto = require('crypto');
|
||||
const fs = require('fs');
|
||||
const { URL } = require('url');
|
||||
|
||||
const repository = process.env.GITHUB_REPOSITORY;
|
||||
const version = process.env.VERSION;
|
||||
const targetAbi = "10.9.9.0";
|
||||
|
||||
// Read manifest.json
|
||||
const manifestPath = './manifest.json';
|
||||
if (!fs.existsSync(manifestPath)) {
|
||||
@ -12,12 +16,12 @@ if (!fs.existsSync(manifestPath)) {
|
||||
const jsonData = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
|
||||
|
||||
const newVersion = {
|
||||
version: process.env.VERSION, // replace with the actual new version
|
||||
changelog: "- See the full changelog at [GitHub](https://github.com/jumoog/intro-skipper/blob/master/CHANGELOG.md)\n",
|
||||
targetAbi: "10.9.9.0",
|
||||
sourceUrl: process.env.SOURCE_URL,
|
||||
checksum: process.env.CHECKSUM,
|
||||
timestamp: process.env.TIMESTAMP
|
||||
version,
|
||||
changelog: `- See the full changelog at [GitHub](https://github.com/${repository}/blob/master/CHANGELOG.md)\n`,
|
||||
targetAbi,
|
||||
sourceUrl: `https://github.com/${repository}/releases/download/10.9/v${version}/intro-skipper-v${version}.zip`,
|
||||
checksum: getMD5FromFile(),
|
||||
timestamp: new Date().toISOString().replace(/\.\d{3}Z$/, 'Z')
|
||||
};
|
||||
|
||||
async function updateManifest() {
|
||||
@ -101,6 +105,11 @@ async function downloadAndHashFile(url, redirects = 5) {
|
||||
});
|
||||
}
|
||||
|
||||
function getMD5FromFile() {
|
||||
const fileBuffer = fs.readFileSync(`intro-skipper-v${version}.zip`);
|
||||
return crypto.createHash('md5').update(fileBuffer).digest('hex');
|
||||
}
|
||||
|
||||
async function run() {
|
||||
await updateManifest();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user