aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/push-test.yml20
-rw-r--r--.github/workflows/release.yml36
-rw-r--r--scripts/check_version_numbers.py24
-rw-r--r--scripts/create-release-file.py44
-rw-r--r--src-tauri/tauri.conf.json2
5 files changed, 122 insertions, 4 deletions
diff --git a/.github/workflows/push-test.yml b/.github/workflows/push-test.yml
index acbe18ed..04df933b 100644
--- a/.github/workflows/push-test.yml
+++ b/.github/workflows/push-test.yml
@@ -2,7 +2,21 @@ name: "test-on-push"
on: [push, pull_request]
jobs:
+ # Ensure version numbers in various places match up
+ ensure-same-version:
+ runs-on: ubuntu-20.04
+ steps:
+ - uses: actions/checkout@v2
+ - name: install dependencies
+ run: |
+ pip install toml
+ - name: Run check
+ run: |
+ python3 scripts/check_version_numbers.py
+
+
test-tauri:
+ needs: ensure-same-version
strategy:
fail-fast: false
matrix:
@@ -39,6 +53,6 @@ jobs:
uses: actions/upload-artifact@v2
with:
path: |
- src-tauri/target/release/bundle/appimage/*.AppImage
- src-tauri/target/release/bundle/deb/*.deb
- src-tauri/target/release/bundle/msi/*.msi
+ src-tauri/target/release/bundle/appimage/*
+ src-tauri/target/release/bundle/deb/*
+ src-tauri/target/release/bundle/msi/*
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 09402c83..26e162b8 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -4,7 +4,20 @@ on:
types: [ created ]
jobs:
+ # Ensure version numbers in various places match up
+ ensure-same-version:
+ runs-on: ubuntu-20.04
+ steps:
+ - uses: actions/checkout@v2
+ - name: install dependencies
+ run: |
+ pip install toml
+ - name: Run check
+ run: |
+ python3 scripts/check_version_numbers.py --release ${{github.event.release.tag_name}}
+
build:
+ needs: ensure-same-version
strategy:
fail-fast: false
matrix:
@@ -37,6 +50,13 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
+ - name: upload build artifact
+ uses: actions/upload-artifact@v2
+ with:
+ path: |
+ src-tauri/target/release/bundle/appimage/*
+ src-tauri/target/release/bundle/deb/*
+ src-tauri/target/release/bundle/msi/*
- name: Release
uses: softprops/action-gh-release@v1
with:
@@ -44,3 +64,19 @@ jobs:
src-tauri/target/release/bundle/appimage/*
src-tauri/target/release/bundle/deb/*
src-tauri/target/release/bundle/msi/*
+
+ create-release-file:
+ needs: build
+ runs-on: ubuntu-20.04
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/download-artifact@v3
+ - name: Create release file
+ run: |
+ python3 scripts/create-release-file.py --version ${{github.event.release.tag_name}}
+
+ - name: upload release file
+ uses: softprops/action-gh-release@v1
+ with:
+ files: |
+ latest-release.json
diff --git a/scripts/check_version_numbers.py b/scripts/check_version_numbers.py
new file mode 100644
index 00000000..4b8d0fe8
--- /dev/null
+++ b/scripts/check_version_numbers.py
@@ -0,0 +1,24 @@
+# %%
+""""Ensure that version numbers between `tauri.conf.json`, `cargo.toml`, and GitHub release are the same"""
+import json
+import toml
+import sys
+
+with open("src-tauri/tauri.conf.json", "rt") as f:
+ tauri_conf_json = json.load(f)
+
+with open("src-tauri/Cargo.toml", "rt") as f:
+ Cargo_toml = toml.load(f)
+
+tauri_conf_json_version = tauri_conf_json["package"]["version"]
+Cargo_toml_version = Cargo_toml["package"]["version"]
+
+# Ensure same
+assert(tauri_conf_json_version == Cargo_toml_version)
+
+# Check release tag additionally if release
+if "--release" in sys.argv:
+ print("TODO")
+ release_tag = sys.argv[2]
+ print(release_tag)
+ assert(release_tag == f"v{tauri_conf_json_version}")
diff --git a/scripts/create-release-file.py b/scripts/create-release-file.py
new file mode 100644
index 00000000..1c364d90
--- /dev/null
+++ b/scripts/create-release-file.py
@@ -0,0 +1,44 @@
+# %%
+import json
+import datetime
+import sys
+
+assert("--version" in sys.argv)
+
+version_number = sys.argv[2]
+version_number_stripped_v = version_number.replace("v", "")
+
+PATH_TO_LINUX_SIG = f"./artifact/appimage/flightcore_{version_number_stripped_v}_amd64.AppImage.tar.gz.sig"
+PATH_TO_WINDOWS_SIG = f"./artifact/msi/flightcore_{version_number_stripped_v}_x64_en-US.msi.zip.sig"
+
+# Read signatures
+with open(PATH_TO_LINUX_SIG, "rt") as f:
+ linux_sig = f.read()
+with open(PATH_TO_WINDOWS_SIG, "rt") as f:
+ windows_sig = f.read()
+
+
+current_datetime_string = str(datetime.datetime.utcnow().replace(microsecond=0).isoformat() + "Z")
+
+release_dict = {
+ "version": f"{version_number}",
+ "notes": "Test version",
+ "pub_date": current_datetime_string,
+ "platforms": {
+ "linux-x86_64": {
+ "signature": linux_sig,
+ "url": f"https://github.com/GeckoEidechse/FlightCore/releases/download/{version_number}/flightcore_{version_number_stripped_v}_amd64.AppImage.tar.gz"
+ },
+ "windows-x86_64": {
+ "signature": windows_sig,
+ "url": f"https://github.com/GeckoEidechse/FlightCore/releases/download/{version_number}/flightcore_{version_number_stripped_v}_x64_en-US.msi.zip"
+ }
+ }
+}
+json_string = json.dumps(release_dict, indent=4)
+print(json_string)
+# %%
+RESULT_JSON_FILENAME = "latest-release.json"
+with open(RESULT_JSON_FILENAME, "wt") as f:
+ f.write(json_string)
+# %%
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index 2a117a8d..39135471 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -54,7 +54,7 @@
"active": true,
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEVBNjM3NzJGRDgxMTU4NUUKUldSZVdCSFlMM2RqNmdhK3pIZjhEYWg2WnZGSFJqdkhLSHNOSjNhaW5VQVFLaHV3YWFDTnFKWWQK",
"endpoints": [
- "https://gist.githubusercontent.com/GeckoEidechse/a607a04213af58a0f6f98613b4bee863/raw/FlightCore-currentrelease.json"
+ "https://github.com/GeckoEidechse/FlightCore/releases/latest/download/latest-release.json"
],
"dialog": true
},