release: isolate the updater configuration, only use it when releasing

This commit is contained in:
Tyler Wilding 2022-04-28 17:53:56 -04:00
parent f110d022df
commit fba898bb08
No known key found for this signature in database
GPG key ID: A89403EB356ED106
7 changed files with 40 additions and 10 deletions

View file

@ -55,6 +55,10 @@ jobs:
popd
node ./.github/scripts/download-binaries/index.js
- name: prepare release config
run: |
npm run prepare-release-config
- name: prepare resources for build
if: matrix.os == 'windows'
run: |
@ -86,6 +90,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
with:
configPath: "./.tauri/release-config.combined.json"
tagName: "v__VERSION__"
releaseName: "OpenGOAL Launcher v__VERSION__"
releaseBody: "See the assets to download this version and install."

1
.tauri/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
release-config.combined.json

View file

@ -0,0 +1,12 @@
{
"tauri": {
"updater": {
"active": true,
"endpoints": [
"https://raw.githubusercontent.com/open-goal/launcher/main/.tauri/latest-release.json"
],
"dialog": true,
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEJGQjRCQzI1N0I4REZBMzIKUldReStvMTdKYnkwditmb2IvK3hJUm9xdjJMMlN2N2tRejlON0djdE03YnhGOHlaTzVwUy9IY2YK"
}
}
}

View file

@ -13,7 +13,9 @@
"update-bin": "node ./scripts/update-binaries.js && npm run package",
"lint": "npx prettier --check .",
"format": "npx prettier --write .",
"mock-bin": "node ./scripts/dummy-binaries.js"
"mock-bin": "node ./scripts/dummy-binaries.js",
"prepare-release-config": "node ./scripts/merge-config.js",
"release": "npm run prepare-release-config && npm run tauri build -- --config ./.tauri/release-config.combined.json"
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^1.0.0-next.30",

18
scripts/merge-config.js Normal file
View file

@ -0,0 +1,18 @@
// The tauri-action for Github Actions doesn't let you merge configs
// like can be done with --config on the `tauri` command
// instead it replaces the file
//
// So for now, do the merge ourselves, why? because we don't want to maintain two configs
// that will just end up drifting and breaking on release time.
import { readFileSync, writeFileSync } from "fs";
let releaseOptions = JSON.parse(readFileSync("./.tauri/release-config.json"));
let existingConfig = JSON.parse(readFileSync("./src-tauri/tauri.conf.json"));
existingConfig.tauri.updater = releaseOptions.tauri.updater;
writeFileSync(
"./.tauri/release-config.combined.json",
JSON.stringify(existingConfig, null, 2)
);

2
src-tauri/Cargo.lock generated
View file

@ -55,7 +55,7 @@ checksum = "4361135be9122e0870de935d7c439aef945b9f9ddd4199a553b5270b49c82a27"
[[package]]
name = "app"
version = "0.0.1"
version = "0.2.2"
dependencies = [
"serde",
"serde_json",

View file

@ -45,14 +45,6 @@
"timestampUrl": ""
}
},
"updater": {
"active": true,
"endpoints": [
"https://raw.githubusercontent.com/open-goal/launcher/main/.tauri/latest-release.json"
],
"dialog": true,
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEJGQjRCQzI1N0I4REZBMzIKUldReStvMTdKYnkwditmb2IvK3hJUm9xdjJMMlN2N2tRejlON0djdE03YnhGOHlaTzVwUy9IY2YK"
},
"allowlist": {
"all": true,
"fs": {