Skip to content

Commit

Permalink
Merge pull request #25 from williamtcastro/main
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsRiprod authored Aug 24, 2024
2 parents 4276d24 + 22b43b2 commit 09ebb2f
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 63 deletions.
137 changes: 89 additions & 48 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,76 +1,117 @@
name: Build and Release
name: build and release

on:
push:
tags:
- 'v*.*.*' # Triggers on version tags
- 'v*.*.*-*' # Trigger for pre-release tags
- v[0-9]+.[0-9]+.[0-9]+*
workflow_dispatch: # Allows manual triggering

jobs:
build:
runs-on: ${{ matrix.os }}
macos:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

os-version: ['12', '14']
include:
- os-version: '12'
arch: x86_64
- os-version: '14'
arch: aarch64
runs-on: macos-${{ matrix.os-version }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Check out Git repository
uses: actions/checkout@v4
with:
sparse-checkout: |
.github
DeskThingServer
- name: Set up Node.js
uses: actions/setup-node@v3
- name: Install Node.js, NPM
uses: actions/setup-node@v4
with:
node-version: '20'
node-version: 20

- name: Install dependencies
run: |
cd ./DeskThingServer
cd DeskThingServer
npm ci
- name: Run type check
run: |
cd ./DeskThingServer
npm run typecheck
- name: Build application
run: |
cd ./DeskThingServer
npm run build:${{ runner.os }}
- name: Extract version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Build/release Electron app
uses: paneron/action-electron-builder@v1.8.1
with:
github_token: ${{ secrets.github_token }}
package_manager: npm
package_root: ${{ github.workspace }}/DeskThingServer
release: ${{ startsWith(github.ref, 'refs/tags/v') }}

- name: Upload artifact
uses: actions/upload-artifact@v3
- name: Upload binaries to artifacts
uses: actions/upload-artifact@v4
with:
name: DeskThing-${{ steps.get_version.outputs.VERSION }}-${{ runner.os }}
path: ./DeskThingServer/dist/*.*
name: deskthing-macos-${{ matrix.arch }}
path: ${{ github.workspace }}/DeskThingServer/dist/deskthing-*.dmg

release:
needs: build
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest, windows-latest]

name: Build ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Check out Git repository
uses: actions/checkout@v4
with:
sparse-checkout: |
.github
DeskThingServer
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Install Node.js, NPM
uses: actions/setup-node@v4
with:
path: ./dist
node-version: 20

- name: Get the version
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Install dependencies
run: |
cd DeskThingServer
npm ci
- name: Build/release Electron app
uses: paneron/action-electron-builder@v1.8.1
with:
github_token: ${{ secrets.github_token }}
package_manager: npm
package_root: ${{ github.workspace }}/DeskThingServer
release: ${{ startsWith(github.ref, 'refs/tags/v') }}

- name: Update or create release
uses: softprops/action-gh-release@v1
- name: Upload binaries to artifacts
uses: actions/upload-artifact@v4
with:
tag_name: ${{ steps.get_version.outputs.VERSION }}
files: ./dist/**/*
draft: true
prerelease: false
generate_release_notes: true
name: deskthing-${{matrix.os}}
path: ${{ github.workspace }}/DeskThingServer/dist/deskthing*

publish:
needs: [release, macos]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Get Current Release
id: get_current_release
uses: joutvhu/get-release@v1
with:
latest: true
pattern: '^v.*'
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.get_current_release.outputs.tag_name }}
files: |
deskthing-macos-aarch64/*
deskthing-macos-x86_64/*
deskthing-ubuntu-latest/*
deskthing-windows-latest/*
20 changes: 10 additions & 10 deletions DeskThingServer/electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ asarUnpack:
- bin/**
win:
executableName: DeskThing
artifactName: ${name}-${version}-windows-setup.${ext}
artifactName: ${name}-${os}-${version}-setup.${ext}
extraFiles:
- from: "adb_source/win"
to: "resources/win"
- from: 'adb_source/win'
to: 'resources/win'
nsis:
artifactName: ${name}-${version}-setup.${ext}
artifactName: ${name}-${os}-${version}-setup.${ext}
shortcutName: ${productName}
uninstallDisplayName: ${productName}
createDesktopShortcut: always
Expand All @@ -32,21 +32,21 @@ mac:
- NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.
notarize: false
extraFiles:
- from: "adb_source/mac"
to: "resources/mac"
- from: 'adb_source/mac'
to: 'resources/mac'
dmg:
artifactName: ${name}-${version}-mac-setup.${ext}
artifactName: ${name}-${os}-${arch}-${version}-setup.${ext}
linux:
target:
- AppImage
- deb
maintainer: Riprod
category: Utility
extraFiles:
- from: "adb_source/linux"
to: "resources/linux"
- from: 'adb_source/linux'
to: 'resources/linux'
appImage:
artifactName: ${name}-${version}-linux-setup.${ext}
artifactName: ${name}-${os}-${version}-setup.${ext}
npmRebuild: false
publish:
provider: generic
Expand Down
7 changes: 2 additions & 5 deletions DeskThingServer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,9 @@
"typecheck": "npm run typecheck:node && npm run typecheck:web",
"start": "electron-vite preview",
"dev": "electron-vite dev",
"build": "npm run typecheck && electron-vite build",
"build": "npm run typecheck && electron-vite build && electron-builder",
"postinstall": "electron-builder install-app-deps",
"build:unpack": "npm run build && electron-builder --dir",
"build:win": "npm run build && electron-builder --win",
"build:mac": "electron-vite build && electron-builder --mac",
"build:linux": "electron-vite build && electron-builder --linux"
"build:unpack": "npm run build && electron-builder --dir"
},
"dependencies": {
"@electron-toolkit/preload": "^3.0.0",
Expand Down

0 comments on commit 09ebb2f

Please sign in to comment.