mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
build: Implement cross-platform build info script
This commit is contained in:
parent
374a51b77c
commit
d09578735e
12
.github/workflows/main.yml
vendored
12
.github/workflows/main.yml
vendored
@ -26,7 +26,7 @@ jobs:
|
|||||||
cache: "npm"
|
cache: "npm"
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: |
|
- run: |
|
||||||
./bin/update-build-info.sh
|
npm run update-build-info
|
||||||
./bin/build-mac-x64.sh
|
./bin/build-mac-x64.sh
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
@ -44,7 +44,7 @@ jobs:
|
|||||||
cache: "npm"
|
cache: "npm"
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: |
|
- run: |
|
||||||
./bin/update-build-info.sh
|
npm run update-build-info
|
||||||
./bin/build-mac-arm64.sh
|
./bin/build-mac-arm64.sh
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
@ -62,7 +62,7 @@ jobs:
|
|||||||
cache: "npm"
|
cache: "npm"
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: |
|
- run: |
|
||||||
./bin/update-build-info.sh
|
npm run update-build-info
|
||||||
./bin/build-linux-x64.sh
|
./bin/build-linux-x64.sh
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
@ -84,7 +84,7 @@ jobs:
|
|||||||
cache: "npm"
|
cache: "npm"
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: |
|
- run: |
|
||||||
./bin/update-build-info.sh
|
npm run update-build-info
|
||||||
./bin/build-server.sh
|
./bin/build-server.sh
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
@ -109,7 +109,7 @@ jobs:
|
|||||||
cache: "npm"
|
cache: "npm"
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: |
|
- run: |
|
||||||
./bin/update-build-info.sh
|
npm run update-build-info
|
||||||
./bin/build-win-x64.sh DONTPACK
|
./bin/build-win-x64.sh DONTPACK
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
@ -128,7 +128,7 @@ jobs:
|
|||||||
- run: npm ci
|
- run: npm ci
|
||||||
- name: Run installer build
|
- name: Run installer build
|
||||||
run: |
|
run: |
|
||||||
./bin/update-build-info.sh
|
npm run update-build-info
|
||||||
npm run make-electron
|
npm run make-electron
|
||||||
- name: Publish installer artifact
|
- name: Publish installer artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
|
@ -32,7 +32,7 @@ mv package.json.tmp package.json
|
|||||||
|
|
||||||
git add package.json
|
git add package.json
|
||||||
|
|
||||||
./update-build-info.sh
|
npm run update-build-info
|
||||||
|
|
||||||
git add src/services/build.ts
|
git add src/services/build.ts
|
||||||
|
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
echo 'export = { buildDate:"'`date --iso-8601=seconds`'", buildRevision: "'`git log -1 --format="%H"`'" };' > src/services/build.ts
|
|
25
bin/update-build-info.ts
Normal file
25
bin/update-build-info.ts
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import child_process from "child_process";
|
||||||
|
import fs from "fs";
|
||||||
|
|
||||||
|
function getBuildDate() {
|
||||||
|
const now = new Date();
|
||||||
|
now.setMilliseconds(0);
|
||||||
|
return now
|
||||||
|
.toISOString()
|
||||||
|
.replace(".000", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
function getGitRevision() {
|
||||||
|
return child_process.execSync('git log -1 --format="%H"')
|
||||||
|
.toString("utf-8")
|
||||||
|
.trimEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
const output = `\
|
||||||
|
export = {
|
||||||
|
buildDate: "${getBuildDate()}",
|
||||||
|
buildRevision: "${getGitRevision()}"
|
||||||
|
};
|
||||||
|
`;
|
||||||
|
|
||||||
|
fs.writeFileSync("src/services/build.ts", output);
|
@ -40,7 +40,8 @@
|
|||||||
"start-electron-forge": "npm run prepare-dist && electron-forge start",
|
"start-electron-forge": "npm run prepare-dist && electron-forge start",
|
||||||
"make-electron": "npm run webpack && npm run prepare-dist && electron-forge make",
|
"make-electron": "npm run webpack && npm run prepare-dist && electron-forge make",
|
||||||
"package-electron": "electron-forge package",
|
"package-electron": "electron-forge package",
|
||||||
"prepare-dist": "rimraf ./dist && tsc && ts-node ./bin/copy-dist.ts"
|
"prepare-dist": "rimraf ./dist && tsc && ts-node ./bin/copy-dist.ts",
|
||||||
|
"update-build-info": "ts-node bin/update-build-info.ts"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@braintree/sanitize-url": "^7.1.0",
|
"@braintree/sanitize-url": "^7.1.0",
|
||||||
|
@ -1 +1,4 @@
|
|||||||
export = { buildDate:"2024-07-14T22:32:45+03:00", buildRevision: "b811f3d399aed7e740bd8e92ef7edc7d15de7038" };
|
export = {
|
||||||
|
buildDate: "2024-07-21T08:44:01Z",
|
||||||
|
buildRevision: "374a51b77c35f5ff2e619b49f1e7aeda16005945"
|
||||||
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user