Skip to content

Commit

Permalink
Updated CI process and implemented build IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
xanderfrangos committed Jan 5, 2024
1 parent 3617087 commit 8525d5c
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 21 deletions.
26 changes: 14 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ jobs:
runs-on: windows-2022

steps:
- uses: actions/checkout@v3
- name: Use Node.js 18.x
uses: actions/setup-node@v3
- uses: actions/checkout@v4
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 18
cache: 'npm'
- name: package.json info
id: info
uses: jaywcjlove/github-action-package@main
Expand All @@ -22,10 +23,10 @@ jobs:
- run: npm run parcel-build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: npm run electron-build
- run: npm exec electron-builder -- --x64 --config.extraMetadata.version="${{ steps.info.outputs.version }}+${{ github.sha }}" --config.win.artifactName="Twinkle Tray v${{ steps.info.outputs.version }}.exe"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
name: Upload Windows Installer
with:
name: twinkle-tray-exe-${{ github.ref_name }}-${{ github.sha }}
Expand All @@ -35,11 +36,12 @@ jobs:
runs-on: windows-2022

steps:
- uses: actions/checkout@v3
- name: Use Node.js 18.x
uses: actions/setup-node@v3
- uses: actions/checkout@v4
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 18
cache: 'npm'
- name: package.json info
id: info
uses: jaywcjlove/github-action-package@main
Expand All @@ -49,15 +51,15 @@ jobs:
- run: npm run appx
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
name: Upload x64 AppX
with:
name: twinkle-tray-appx-x64-${{ github.ref_name }}-${{ github.sha }}
path: dist/*-store.appx
- run: npm run appx-arm64
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
name: Upload ARM64 AppX
with:
name: twinkle-tray-appx-arm64-${{ github.ref_name }}-${{ github.sha }}
Expand Down
2 changes: 1 addition & 1 deletion src/components/SettingsWindow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1290,7 +1290,7 @@ export default class SettingsWindow extends PureComponent {
<SettingsPage current={this.state.activePage} id="updates">
<div className="pageSection">
<div className="sectionTitle">{T.t("SETTINGS_UPDATES_TITLE")}</div>
<p>{T.h("SETTINGS_UPDATES_VERSION", '<b>' + (window.version || "not available") + '</b>')}</p>
<p>{T.h("SETTINGS_UPDATES_VERSION", '<b>' + (window.version ? `${window.version}${window.versionTag && window.versionBuild ? ` (${window.versionBuild})` : ""}` : "not available") + '</b>')}</p>
{this.getUpdate()}
</div>
<div className="pageSection" style={{ display: (window.isAppX ? "none" : (this.isSection("updates") ? "block" : "none")) }}>
Expand Down
27 changes: 19 additions & 8 deletions src/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ const { BrowserWindow, nativeTheme, systemPreferences, Menu, ipcMain, app, scree
const Utils = require("./Utils")
const uuid = require('crypto').randomUUID

const appVersionFull = app.getVersion()
const appVersion = appVersionFull.split('+')[0]
const appVersionTag = appVersion?.split('-')[1]
const appBuild = appVersionFull.split('+')[1]
const appBuildShort = (appBuild && appBuild.length > 7 ? appBuild.slice(0, 7) : appBuild)

// Expose GC
app.commandLine.appendSwitch('js-flags', '--expose_gc --max-old-space-size=128')
app.commandLine.appendSwitch('disable-http-cache')
Expand Down Expand Up @@ -325,12 +331,12 @@ function pingAnalytics() {
events.push({
name: "page_view",
params: {
page_location: app.name + "/" + "v" + app.getVersion(),
page_title: app.name + "/" + "v" + app.getVersion(),
page_location: app.name + "/" + "v" + appVersion + "/" + (appBuild ? appBuild : ""),
page_title: app.name + "/" + "v" + appVersion,
page_referrer: app.name,
os_version: require("os").release(),
app_type: app.name,
app_version: app.getVersion(),
app_version: appVersion,
engagement_time_msec: 1
}
})
Expand Down Expand Up @@ -367,6 +373,8 @@ if (!fs.existsSync(configFilesDir)) {

const defaultSettings = {
isDev,
settingsVer: "v" + appVersion,
settingsBuild: appBuild,
userClosedIntro: false,
theme: "default",
icon: "icon",
Expand All @@ -391,7 +399,6 @@ const defaultSettings = {
checkForUpdates: !isDev,
dismissedUpdate: '',
language: "system",
settingsVer: "v" + app.getVersion(),
names: {},
analytics: !isDev,
scrollShortcut: true,
Expand Down Expand Up @@ -625,7 +632,7 @@ function processSettings(newSettings = {}, sendUpdate = true) {

try {

settings.settingsVer = "v" + app.getVersion()
settings.settingsVer = "v" + appVersion

if (settings.theme) {
nativeTheme.themeSource = determineTheme(settings.theme)
Expand Down Expand Up @@ -2188,7 +2195,9 @@ function createPanel(toggleOnLoad = false, isRefreshing = false) {
zoomFactor: 1.0,
additionalArguments: ["jsVars" + Buffer.from(JSON.stringify({
appName: app.name,
appVersion: app.getVersion(),
appVersion: appVersion,
appVersionTag: appVersionTag,
appBuild: appBuildShort,
isRefreshing: isRefreshing
})).toString('base64')],
allowRunningInsecureContent: true,
Expand Down Expand Up @@ -3112,7 +3121,9 @@ function createSettings() {
zoomFactor: 1.0,
additionalArguments: ["jsVars" + Buffer.from(JSON.stringify({
appName: app.name,
appVersion: app.getVersion(),
appVersion: appVersion,
appVersionTag: appVersionTag,
appBuild: appBuildShort,
settings,
lastTheme,
settingsPath
Expand Down Expand Up @@ -3226,7 +3237,7 @@ checkForUpdates = async (force = false) => {
}
}

if (foundVersion && "v" + app.getVersion() != latestVersion.version && (settings.dismissedUpdate != latestVersion.version || force)) {
if (foundVersion && "v" + appVersion != latestVersion.version && (settings.dismissedUpdate != latestVersion.version || force)) {
if (!force) latestVersion.show = true
console.log("Sending new version to windows.")
sendToAllWindows('latest-version', latestVersion)
Expand Down
2 changes: 2 additions & 0 deletions src/settings-preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,5 +261,7 @@ window.accent = "cyan"
window.getSunCalcTimes = getSunCalcTimes

window.version = 'v' + getArgumentVars().appVersion
window.versionTag = getArgumentVars().appVersionTag
window.versionBuild = getArgumentVars().appBuild
window.isAppX = (getArgumentVars().appName == "twinkle-tray-appx" ? true : false)
window.settingsPath = getArgumentVars().settingsPath

0 comments on commit 8525d5c

Please sign in to comment.