From e8cba3e5751d9fcdcaed260f629c8663f64247ef Mon Sep 17 00:00:00 2001 From: Rafael Araujo Lehmkuhl Date: Thu, 10 Oct 2024 16:56:20 -0300 Subject: [PATCH] ci: Publish `latest.yml` for Electron auto-updates --- .github/workflows/ci.yml | 36 +++++++++++++++++++++--------------- package.json | 4 ++-- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 53659d116..701c3eff9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -107,31 +107,26 @@ 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: 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: + 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 }} + 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: @@ -142,6 +137,17 @@ jobs: 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/latest-*.yml + tag: ${{ github.ref }} + overwrite: true + prerelease: true + file_glob: true + deploy-flatpak: needs: test runs-on: ${{ matrix.os }} diff --git a/package.json b/package.json index b447354e9..ec4c0d037 100644 --- a/package.json +++ b/package.json @@ -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.", @@ -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 --artifactName=${name}-${os}-${version}.${ext} -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",