diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml new file mode 100644 index 0000000..ff54790 --- /dev/null +++ b/.forgejo/workflows/release.yml @@ -0,0 +1,61 @@ +name: Release + +on: + push: + tags: + - 'v*' + workflow_dispatch: + +jobs: + linux-release: + name: Build Linux Release + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + + - name: Install dependencies + run: npm ci + + - name: Build Linux packages + run: npm run dist:linux -- --publish never + + - name: Create Forgejo release + if: startsWith(github.ref, 'refs/tags/v') + env: + FORGEJO_TOKEN: ${{ github.token }} + FORGEJO_API: https://git.danvics.com/api/v1 + REPO: ${{ github.repository }} + 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") + echo "release_id=$release_id" >> "$GITHUB_ENV" + + - name: Upload release assets + if: startsWith(github.ref, 'refs/tags/v') + env: + FORGEJO_TOKEN: ${{ github.token }} + FORGEJO_API: https://git.danvics.com/api/v1 + REPO: ${{ github.repository }} + run: | + set -eu + for artifact in release/*.AppImage release/*.deb; do + [ -f "$artifact" ] || continue + name=$(basename "$artifact") + curl -sS -X POST "$FORGEJO_API/repos/$REPO/releases/$release_id/assets?name=$name" \ + -H "Authorization: token $FORGEJO_TOKEN" \ + -H "Content-Type: application/octet-stream" \ + --data-binary "@$artifact" + done diff --git a/package-lock.json b/package-lock.json index bd1c6c3..f438dc9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "nextcloud-notes-desktop", - "version": "0.1.0", + "version": "0.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "nextcloud-notes-desktop", - "version": "0.1.0", + "version": "0.1.1", "dependencies": { "react": "^19.2.6", "react-dom": "^19.2.6", diff --git a/package.json b/package.json index 4913ed4..4d96a8d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nextcloud-notes-desktop", - "version": "0.1.0", + "version": "0.1.1", "private": true, "description": "Fast cross-platform desktop client for Nextcloud Notes", "author": {