Skip to content

Commit

Permalink
ci: Publish latest.yml for Electron auto-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaellehmkuhl committed Oct 11, 2024
1 parent 00b89b5 commit 5d05377
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 20 deletions.
57 changes: 39 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,28 @@ jobs:
matrix:
include:
- os: macos-13
suffix: macos
suffix: mac
arch: x64
extension: dmg
latestMetadataName: latest-mac.yml

- os: ubuntu-latest
suffix: linux
arch: x86_64
extension: AppImage
latestMetadataName: latest-linux.yml

- os: ubuntu-24-arm
suffix: linux-arm
arch: arm64
extension: AppImage
latestMetadataName: latest-linux-arm64.yml

- os: windows-latest
suffix: windows
suffix: win
arch: x64
extension: exe
latestMetadataName: latest.yml

steps:
- name: Checkout
Expand All @@ -99,6 +107,11 @@ jobs:
with:
bun-version: latest

- name: Set version environment variable
run: |
echo "VERSION=$(git describe --tags --abbrev=0 | sed 's/^v//')" >> $GITHUB_ENV
echo "VERSION=$(git describe --tags --abbrev=0 | sed 's/^v//')" >> $env:GITHUB_ENV
- name: Bun build
run: |
bun install --frozen-lockfile
Expand All @@ -107,36 +120,44 @@ jobs:
- name: Bun deploy (arm)
if: matrix.os == 'ubuntu-24-arm'
run: |
SNAPCRAFT_BUILD_ENVIRONMENT="host" bun deploy:electron
SNAPCRAFT_BUILD_ENVIRONMENT="host" bun run deploy:electron
- name: Bun deploy (others)
if: matrix.os != 'ubuntu-24-arm'
run: |
bun deploy:electron
- name: Build artifact name
if: "!startsWith(github.ref, 'refs/tags/') && success()"
run: |
mv dist/Cockpit*.${{ matrix.extension }} dist/Cockpit-${{ matrix.suffix }}-$(git describe --tags).${{ matrix.extension }}
bun run deploy:electron
- name: Build tag name
if: startsWith(github.ref, 'refs/tags/') && success()
run: |
mv dist/Cockpit*.${{ matrix.extension }} dist/Cockpit-${{ matrix.suffix }}-$(git describe --tags --abbrev=0).${{ matrix.extension }}
- name: Upload binary artifact
uses: actions/upload-artifact@v3
with:
name: Cockpit-${{ env.VERSION }}-${{ matrix.suffix }}-${{ matrix.arch }}.${{ matrix.extension }}
path: dist/Cockpit*.${{ matrix.extension }}
if-no-files-found: error

- name: Upload Artifact
- name: Upload latest metadata artifact
uses: actions/upload-artifact@v3
with:
name: cockpit-${{ matrix.suffix }}
path: dist/Cockpit-${{ matrix.suffix }}-*.${{ matrix.extension }}
name: ${{ matrix.latestMetadataName }}
path: dist/latest*.yml
if-no-files-found: error

- name: Upload Release
- name: Upload binary release
uses: svenstaro/upload-release-action@v2
if: startsWith(github.ref, 'refs/tags/') && success()
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/Cockpit-${{ env.VERSION }}-${{ matrix.suffix }}-${{ matrix.arch }}.${{ matrix.extension }}
tag: ${{ github.ref }}
overwrite: true
prerelease: true
file_glob: true

- name: Upload latest metadata release
uses: svenstaro/upload-release-action@v2
if: startsWith(github.ref, 'refs/tags/') && success()
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/Cockpit-${{ matrix.suffix }}-*.${{ matrix.extension }}
file: dist/${{ matrix.latestMetadataName }}
tag: ${{ github.ref }}
overwrite: true
prerelease: true
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cockpit",
"version": "1.2.1",
"version": "0.0.0",
"private": true,
"main": "dist/electron/main.js",
"description": "An intuitive and customizable cross-platform ground control station for remote vehicles of all types.",
Expand All @@ -9,7 +9,7 @@
"build:serve": "bun run build && bun run serve",
"coverage": "vitest --coverage",
"deploy:electron:dir": "electron-builder --dir",
"deploy:electron": "electron-builder --publish=never",
"deploy:electron": "electron-builder --publish=never -c.extraMetadata.version=$(git describe --tags --abbrev=0 | sed 's/^v//')",
"deploy:flatpak": "electron-builder --x64 --linux flatpak",
"dev": "vite --host",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --ignore-path .gitignore --max-warnings=0",
Expand Down Expand Up @@ -125,6 +125,7 @@
"provider": "github",
"owner": "bluerobotics"
},
"artifactName": "${productName}-${version}-${os}-${arch}.${ext}",
"mac": {
"category": "public.app-category.utilities",
"icon": "public/pwa-512x512.png"
Expand Down

0 comments on commit 5d05377

Please sign in to comment.