Begin work on the manifest preparation step for actions
This commit is contained in:
parent
834f169a80
commit
00692431cd
2 changed files with 55 additions and 6 deletions
|
|
@ -40,14 +40,19 @@ jobs:
|
|||
- create-artifacts
|
||||
if: var.RELEASE_TO_FORGEJO
|
||||
steps:
|
||||
- name: download artifacts
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
merge-multiple: true
|
||||
|
||||
- name: update manifest
|
||||
- name: Update manifest
|
||||
run: node scripts/updateManifest.mjs
|
||||
env:
|
||||
# TODO: determine fully qualified URLs
|
||||
DOWNLOAD_URL: "${{FORGEJO_SERVER_URL}}/${{FORGEJO_REPOSITORY}}/releases/"
|
||||
LATEST_URL: "${{FORGEJO_SERVER_URL}}/${{FORGEJO_REPOSITORY}}/releases/"
|
||||
|
||||
- name: create draft release
|
||||
- name: Create draft release
|
||||
|
||||
|
||||
github-release:
|
||||
|
|
@ -56,11 +61,16 @@ jobs:
|
|||
- create-artifacts
|
||||
if: var.RELEASE_TO_GITHUB
|
||||
steps:
|
||||
- name: download artifacts
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
merge-multiple: true
|
||||
|
||||
- name: update manifest
|
||||
- name: Update manifest
|
||||
run: node scripts/updateManifest.mjs
|
||||
env:
|
||||
# TODO: determine fully qualified URLs
|
||||
DOWNLOAD_URL: "https://github.com/${{vars.GH_USER}}/${{vars.GH_REPO}}/releases"
|
||||
LATEST_URL: "https://github.com/${{vars.GH_USER}}/${{vars.GH_REPO}}/releases"
|
||||
|
||||
- name: create draft release
|
||||
- name: Create draft release
|
||||
|
|
|
|||
39
scripts/prepareManifest.mjs
Normal file
39
scripts/prepareManifest.mjs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
The intent of this script is to do all of the modifications of the
|
||||
manifest file that we need to do in order to release the system.
|
||||
This can include removing dev-only fields/attributes that end
|
||||
users will never, and should never, care about nor need.
|
||||
*/
|
||||
import { readFile, writeFile } from "fs/promises";
|
||||
|
||||
const MANIFEST_PATH = `system.json`;
|
||||
|
||||
const {
|
||||
DOWNLOAD_URL,
|
||||
LATEST_URL,
|
||||
} = process.env;
|
||||
|
||||
let manifest;
|
||||
try {
|
||||
manifest = JSON.parse(await readFile(MANIFEST_PATH, `utf-8`));
|
||||
} catch {
|
||||
console.error(`Failed to parse manifest file.`);
|
||||
process.exit(1);
|
||||
};
|
||||
|
||||
|
||||
// Filter out dev-only resources
|
||||
if (manifest.esmodules) {
|
||||
manifest.esmodules = manifest.esmodules.filter(
|
||||
filepath => !filepath.startsWith(`dev/`)
|
||||
);
|
||||
};
|
||||
|
||||
// Remove dev flags
|
||||
delete manifest.flags?.hotReload;
|
||||
|
||||
if (Object.keys(manifest.flags).length === 0) {
|
||||
delete manifest.flags;
|
||||
};
|
||||
|
||||
await writeFile(MANIFEST_PATH, JSON.stringify(manifest, undefined, `\t`));
|
||||
Loading…
Add table
Add a link
Reference in a new issue