diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml index ff54790..f09f56a 100644 --- a/.forgejo/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -7,9 +7,21 @@ on: workflow_dispatch: jobs: - linux-release: - name: Build Linux Release - runs-on: ubuntu-latest + build: + name: Build ${{ matrix.name }} + runs-on: ${{ matrix.runner }} + strategy: + fail-fast: false + matrix: + include: + - name: Linux + runner: ubuntu-latest + command: npm run dist:linux -- --publish never + artifacts: "release/*.AppImage release/*.deb" + - name: macOS + runner: macos-latest + command: npm run dist:mac -- --publish never + artifacts: "release/*.dmg release/*.zip" steps: - name: Checkout @@ -24,10 +36,10 @@ jobs: - name: Install dependencies run: npm ci - - name: Build Linux packages - run: npm run dist:linux -- --publish never + - name: Build packages + run: ${{ matrix.command }} - - name: Create Forgejo release + - name: Create or find Forgejo release if: startsWith(github.ref, 'refs/tags/v') env: FORGEJO_TOKEN: ${{ github.token }} @@ -36,11 +48,16 @@ jobs: TAG: ${{ github.ref_name }} run: | set -eu - response=$(curl -sS -X POST "$FORGEJO_API/repos/$REPO/releases" \ - -H "Authorization: token $FORGEJO_TOKEN" \ - -H "Content-Type: application/json" \ - -d "{\"tag_name\":\"$TAG\",\"target_commitish\":\"main\",\"name\":\"$TAG\",\"body\":\"Automated Linux desktop build.\",\"draft\":false,\"prerelease\":false}") - release_id=$(node -e "const data = JSON.parse(process.argv[1]); if (!data.id) throw new Error(JSON.stringify(data)); console.log(data.id)" "$response") + response=$(curl -sS "$FORGEJO_API/repos/$REPO/releases/tags/$TAG" \ + -H "Authorization: token $FORGEJO_TOKEN") + release_id=$(node -e "const data = JSON.parse(process.argv[1]); console.log(data.id || '')" "$response") + if [ -z "$release_id" ]; then + response=$(curl -sS -X POST "$FORGEJO_API/repos/$REPO/releases" \ + -H "Authorization: token $FORGEJO_TOKEN" \ + -H "Content-Type: application/json" \ + -d "{\"tag_name\":\"$TAG\",\"target_commitish\":\"main\",\"name\":\"$TAG\",\"body\":\"Automated desktop builds from Forgejo runners.\",\"draft\":false,\"prerelease\":false}") + release_id=$(node -e "const data = JSON.parse(process.argv[1]); if (!data.id) throw new Error(JSON.stringify(data)); console.log(data.id)" "$response") + fi echo "release_id=$release_id" >> "$GITHUB_ENV" - name: Upload release assets @@ -49,9 +66,10 @@ jobs: FORGEJO_TOKEN: ${{ github.token }} FORGEJO_API: https://git.danvics.com/api/v1 REPO: ${{ github.repository }} + ARTIFACTS: ${{ matrix.artifacts }} run: | set -eu - for artifact in release/*.AppImage release/*.deb; do + for artifact in $ARTIFACTS; do [ -f "$artifact" ] || continue name=$(basename "$artifact") curl -sS -X POST "$FORGEJO_API/repos/$REPO/releases/$release_id/assets?name=$name" \ diff --git a/README.md b/README.md index 00e1c65..5aa5bcf 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ macOS DMG builds must run on macOS because the DMG toolchain and `dmg-license` d ## CI Releases -GitHub Actions builds release artifacts on native runners for Linux, Windows, and macOS. Push a version tag to publish artifacts to a GitHub Release: +Forgejo Actions builds release artifacts on registered runners. The Linux job uses the existing `ubuntu-latest` runner; the macOS job expects a Forgejo runner registered with the `macos-latest` label so it can build DMG/zip artifacts natively. Push a version tag to publish artifacts to a Forgejo Release: ```bash git tag v0.1.0 diff --git a/package-lock.json b/package-lock.json index f438dc9..b189682 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "nextcloud-notes-desktop", - "version": "0.1.1", + "version": "0.1.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "nextcloud-notes-desktop", - "version": "0.1.1", + "version": "0.1.2", "dependencies": { "react": "^19.2.6", "react-dom": "^19.2.6", diff --git a/package.json b/package.json index 4d96a8d..d8171ce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nextcloud-notes-desktop", - "version": "0.1.1", + "version": "0.1.2", "private": true, "description": "Fast cross-platform desktop client for Nextcloud Notes", "author": {