-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from williamtcastro/main
- Loading branch information
Showing
3 changed files
with
101 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters