Use Forgejo runners for release builds
This commit is contained in:
parent
6104851b8e
commit
0076b37a23
4 changed files with 34 additions and 16 deletions
|
|
@ -7,9 +7,21 @@ on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
linux-release:
|
build:
|
||||||
name: Build Linux Release
|
name: Build ${{ matrix.name }}
|
||||||
runs-on: ubuntu-latest
|
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:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|
@ -24,10 +36,10 @@ jobs:
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
- name: Build Linux packages
|
- name: Build packages
|
||||||
run: npm run dist:linux -- --publish never
|
run: ${{ matrix.command }}
|
||||||
|
|
||||||
- name: Create Forgejo release
|
- name: Create or find Forgejo release
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
env:
|
env:
|
||||||
FORGEJO_TOKEN: ${{ github.token }}
|
FORGEJO_TOKEN: ${{ github.token }}
|
||||||
|
|
@ -36,11 +48,16 @@ jobs:
|
||||||
TAG: ${{ github.ref_name }}
|
TAG: ${{ github.ref_name }}
|
||||||
run: |
|
run: |
|
||||||
set -eu
|
set -eu
|
||||||
response=$(curl -sS -X POST "$FORGEJO_API/repos/$REPO/releases" \
|
response=$(curl -sS "$FORGEJO_API/repos/$REPO/releases/tags/$TAG" \
|
||||||
-H "Authorization: token $FORGEJO_TOKEN" \
|
-H "Authorization: token $FORGEJO_TOKEN")
|
||||||
-H "Content-Type: application/json" \
|
release_id=$(node -e "const data = JSON.parse(process.argv[1]); console.log(data.id || '')" "$response")
|
||||||
-d "{\"tag_name\":\"$TAG\",\"target_commitish\":\"main\",\"name\":\"$TAG\",\"body\":\"Automated Linux desktop build.\",\"draft\":false,\"prerelease\":false}")
|
if [ -z "$release_id" ]; then
|
||||||
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 -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"
|
echo "release_id=$release_id" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
- name: Upload release assets
|
- name: Upload release assets
|
||||||
|
|
@ -49,9 +66,10 @@ jobs:
|
||||||
FORGEJO_TOKEN: ${{ github.token }}
|
FORGEJO_TOKEN: ${{ github.token }}
|
||||||
FORGEJO_API: https://git.danvics.com/api/v1
|
FORGEJO_API: https://git.danvics.com/api/v1
|
||||||
REPO: ${{ github.repository }}
|
REPO: ${{ github.repository }}
|
||||||
|
ARTIFACTS: ${{ matrix.artifacts }}
|
||||||
run: |
|
run: |
|
||||||
set -eu
|
set -eu
|
||||||
for artifact in release/*.AppImage release/*.deb; do
|
for artifact in $ARTIFACTS; do
|
||||||
[ -f "$artifact" ] || continue
|
[ -f "$artifact" ] || continue
|
||||||
name=$(basename "$artifact")
|
name=$(basename "$artifact")
|
||||||
curl -sS -X POST "$FORGEJO_API/repos/$REPO/releases/$release_id/assets?name=$name" \
|
curl -sS -X POST "$FORGEJO_API/repos/$REPO/releases/$release_id/assets?name=$name" \
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ macOS DMG builds must run on macOS because the DMG toolchain and `dmg-license` d
|
||||||
|
|
||||||
## CI Releases
|
## 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
|
```bash
|
||||||
git tag v0.1.0
|
git tag v0.1.0
|
||||||
|
|
|
||||||
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "nextcloud-notes-desktop",
|
"name": "nextcloud-notes-desktop",
|
||||||
"version": "0.1.1",
|
"version": "0.1.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "nextcloud-notes-desktop",
|
"name": "nextcloud-notes-desktop",
|
||||||
"version": "0.1.1",
|
"version": "0.1.2",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"react": "^19.2.6",
|
"react": "^19.2.6",
|
||||||
"react-dom": "^19.2.6",
|
"react-dom": "^19.2.6",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "nextcloud-notes-desktop",
|
"name": "nextcloud-notes-desktop",
|
||||||
"version": "0.1.1",
|
"version": "0.1.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "Fast cross-platform desktop client for Nextcloud Notes",
|
"description": "Fast cross-platform desktop client for Nextcloud Notes",
|
||||||
"author": {
|
"author": {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue