Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate electron-updater metadata #1397

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 60 additions & 17 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,14 @@ jobs:
with:
bun-version: latest

- name: Set version as environment variable (Windows)
if: matrix.os == 'windows-latest'
run: echo "VERSION=$(git describe --tags --abbrev=0 | sed 's/^v//')" >> $env:GITHUB_ENV

- name: Set version as environment variable (others)
if: matrix.os != 'windows-latest'
run: echo "VERSION=$(git describe --tags --abbrev=0 | sed 's/^v//')" >> $GITHUB_ENV

- name: Bun build
run: |
bun install --frozen-lockfile
Expand All @@ -107,36 +123,63 @@ 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
bun run 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 }}
- name: Upload binary artifact
uses: actions/upload-artifact@v3
with:
name: Cockpit-${{ matrix.suffix }}-${{ matrix.arch }}-${{ env.VERSION }}.${{ matrix.extension }}
path: dist/Cockpit*.${{ matrix.extension }}
if-no-files-found: error

- 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 diff artifact (mac-only)
if: matrix.os == 'macos-13'
uses: actions/upload-artifact@v3
with:
name: Cockpit-${{ matrix.suffix }}-${{ matrix.arch }}-${{ env.VERSION }}.zip
path: dist/Cockpit*.zip
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-${{ matrix.suffix }}-${{ matrix.arch }}-${{ env.VERSION }}.${{ matrix.extension }}
tag: ${{ github.ref }}
overwrite: true
prerelease: true
file_glob: true

- name: Upload diff release (mac-only)
uses: svenstaro/upload-release-action@v2
if: startsWith(github.ref, 'refs/tags/') && success() && matrix.os == 'macos-13'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/Cockpit-${{ matrix.suffix }}-${{ matrix.arch }}-${{ env.VERSION }}.zip
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
Binary file modified bun.lockb
Binary file not shown.
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 @@ -86,7 +86,7 @@
"autoprefixer": "^10.4.13",
"c8": "^7.11.3",
"electron": "^29.2.0",
"electron-builder": "^24.13.3",
"electron-builder": "^25.1.8",
"eslint": "^8.5.0",
"eslint-plugin-jsdoc": "^43.1.1",
"eslint-plugin-simple-import-sort": "^7.0.0",
Expand Down Expand Up @@ -119,6 +119,11 @@
],
"appId": "org.bluerobotics.cockpit",
"productName": "Cockpit",
"publish": {
"provider": "github",
"owner": "bluerobotics"
},
"artifactName": "${productName}-${os}-${arch}-${version}.${ext}",
"mac": {
"category": "public.app-category.utilities",
"icon": "public/pwa-512x512.png"
Expand Down
Loading