summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2023-12-20 01:07:53 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2023-12-20 01:28:26 +0100
commitfaaeef134fa42392f21d28e31964957930e02a6f (patch)
tree67bb6f7901ab73e6e8f96d54e0665b78e7fce4bd
parentUpload windows nightlies (diff)
downloadnheko-faaeef134fa42392f21d28e31964957930e02a6f.tar.xz
Add appinstaller for windows nightlies
-rw-r--r--.gitlab-ci.yml30
-rw-r--r--resources/NhekoNightly.appinstaller10
2 files changed, 38 insertions, 2 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 732e2faf..501976dc 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -70,17 +70,43 @@ upload-windows:
   image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/alpine:latest
   tags: [docker]
   rules:
-    - if : '$CI_PIPELINE_TRIGGERED == null && $CI_COMMIT_REF_PROTECTED == "true"'
+    - if: '$CI_PIPELINE_TRIGGERED == null && $CI_COMMIT_REF_PROTECTED == "true" && $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/'
+      variables:
+        PACKAGE_NAME: "windows"
+    - if: '$CI_PIPELINE_TRIGGERED == null && $CI_COMMIT_REF_PROTECTED == "true"'
   variables:
     GIT_STRATEGY: none
+    PACKAGE_NAME: "windows-nightly"
   before_script:
     - apk add curl unzip
   script:
     - export VERSION=$(unzip -p artifacts/nheko.msix AppxManifest.xml | sed -n 's/.* Version="\([0-9.]*\)".*/\1/p')
-    - 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file artifacts/nheko.msix "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/windows-nightly/${VERSION}/nheko.msix"'
+    - 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file artifacts/nheko.msix "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${PACKAGE_NAME}/${VERSION}/nheko.msix"'
   needs:
     - job: codesign-windows
 
+pages:
+  stage: deploy
+  image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/alpine:latest
+  tags: [docker]
+  rules:
+    - if: '$CI_PIPELINE_TRIGGERED == null && $CI_COMMIT_REF_PROTECTED == "true"'
+  interruptible: true
+  before_script:
+    - apk add curl jq
+  script:
+    - export LATEST_WINDOWS_NIGHTLY=$(curl "https://nheko.im/api/v4/projects/2/packages?package_name=windows-nightly&order_by=version&sort=desc" | jq -r '.[0].version')
+    - sed "s/0.11.3.4/${LATEST_WINDOWS_NIGHTLY}/g" -i resources/NhekoNightly.appinstaller
+    - mkdir public
+    - mv resources/NhekoNightly.appinstaller public
+  needs:
+    - job: upload-windows
+      optional: true
+      artifacts: false
+  artifacts:
+    paths:
+      - public
+
 build-clazy:
   stage: build
   image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/alpine:latest
diff --git a/resources/NhekoNightly.appinstaller b/resources/NhekoNightly.appinstaller
new file mode 100644
index 00000000..bd94f5d9
--- /dev/null
+++ b/resources/NhekoNightly.appinstaller
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<AppInstaller Uri="https://nheko-reborn.pages.nheko.im/nheko/NhekoNightly.appinstaller" Version="0.0.0.1" xmlns="http://schemas.microsoft.com/appx/appinstaller/2018">
+  <MainPackage Name="im.nheko.Nheko" Version="0.11.3.4" Publisher="CN=Nicolas Werner, O=Nicolas Werner, L=Munich, S=Bavaria, C=DE" Uri="https://nheko.im/api/v4/projects/2/packages/generic/windows-nightly/0.11.3.4/nheko.msix" ProcessorArchitecture="x64" />
+  <UpdateSettings>
+    <!-- We can't set this to check only once a month, so just check once a week. If the user doesn't want that ping, they should install the msix directly. -->
+    <OnLaunch HoursBetweenUpdateChecks="168" ShowPrompt="true" />
+    <ForceUpdateFromAnyVersion>true</ForceUpdateFromAnyVersion>
+  </UpdateSettings>
+</AppInstaller>
+