-
-
Notifications
You must be signed in to change notification settings - Fork 79
[feat] Release workflow and production packaging #379
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
12149fa
release.yml
PinJinx 18c9563
Merge branch 'main' of https://github.com/PinJinx/Rein
PinJinx c202a87
changes
PinJinx 2f8f89e
Merge Conflicts
PinJinx fd75634
[Deploy] Code Rabbit Fixes
PinJinx 6a74ea8
[Deploy] Code Rabbit Fixes 2
PinJinx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,220 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - master | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| check-version: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| version: ${{ steps.get_version.outputs.version }} | ||
| tag: ${{ steps.get_version.outputs.tag }} | ||
| should_release: ${{ steps.check.outputs.should_release }} | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
|
||
| - name: Get current version | ||
| id: get_version | ||
| run: | | ||
| VERSION=$(node -p "require('./package.json').version") | ||
| echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
| echo "tag=v$VERSION" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Check if GitHub release already exists for this version | ||
| id: check | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| TAG="v$(node -p "require('./package.json').version")" | ||
| echo "Checking for existing release with tag: $TAG" | ||
| HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" \ | ||
| -H "Authorization: Bearer $GITHUB_TOKEN" \ | ||
| -H "Accept: application/vnd.github+json" \ | ||
| "https://api.github.com/repos/${{ github.repository }}/releases/tags/$TAG") | ||
| echo "GitHub API response status: $HTTP_STATUS" | ||
| case "$HTTP_STATUS" in | ||
| 404) | ||
| echo "No existing release found — will create one." | ||
| echo "should_release=true" >> $GITHUB_OUTPUT | ||
| ;; | ||
| 200) | ||
| echo "Release $TAG already exists — skipping." | ||
| echo "should_release=false" >> $GITHUB_OUTPUT | ||
| ;; | ||
| *) | ||
| echo "GitHub release lookup failed with HTTP $HTTP_STATUS." >&2 | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| # Build: Windows | ||
| build-windows: | ||
| needs: check-version | ||
| if: needs.check-version.outputs.should_release == 'true' | ||
| runs-on: windows-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | ||
| with: | ||
| node-version: 24 | ||
| cache: npm | ||
|
|
||
| - name: Clean cache | ||
| run: | | ||
| if (Test-Path node_modules) { Remove-Item -Recurse -Force node_modules } | ||
| npm cache clean --force | ||
| shell: pwsh | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci --include=optional | ||
|
|
||
| - name: Rebuild native dependencies | ||
| run: npx electron-builder install-app-deps | ||
|
|
||
| - name: Build frontend | ||
| run: npm run build | ||
|
|
||
| - name: Package Electron app | ||
| run: npm run dist -- --publish=never | ||
|
|
||
| - name: Upload Windows artifact | ||
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | ||
| with: | ||
| name: release-windows | ||
| path: dist/*.exe | ||
| retention-days: 1 | ||
|
|
||
| # Build: Linux | ||
| build-linux: | ||
| needs: check-version | ||
| if: needs.check-version.outputs.should_release == 'true' | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | ||
| with: | ||
| node-version: 24 | ||
| cache: npm | ||
|
|
||
| - name: Install system dependencies | ||
| run: | | ||
| sudo apt-get update -y | ||
| sudo apt-get install -y libgtk-3-dev libnotify-dev libnss3 libxss1 libasound2-dev libx11-dev libxrandr-dev || true | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci --include=optional | ||
|
|
||
| - name: Rebuild native dependencies | ||
| run: npx electron-builder install-app-deps | ||
|
|
||
| - name: Build frontend | ||
| run: npm run build | ||
|
|
||
| - name: Package Electron app | ||
| run: npm run dist -- --publish=never | ||
|
|
||
| - name: Upload Linux artifact | ||
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | ||
| with: | ||
| name: release-linux | ||
| path: dist/*.AppImage | ||
| retention-days: 1 | ||
|
|
||
| #Build: macOS | ||
| build-macos: | ||
| needs: check-version | ||
| if: needs.check-version.outputs.should_release == 'true' | ||
| runs-on: macos-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | ||
| with: | ||
| node-version: 22 | ||
| cache: npm | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci --include=optional | ||
|
|
||
| - name: Rebuild native dependencies | ||
| run: npx electron-builder install-app-deps | ||
|
|
||
| - name: Build frontend | ||
| run: npm run build | ||
|
|
||
| - name: Package Electron app (unsigned) | ||
| env: | ||
| # Skip Apple code signing | ||
| CSC_IDENTITY_AUTO_DISCOVERY: false | ||
| run: npm run dist -- --publish=never | ||
|
PinJinx marked this conversation as resolved.
|
||
| - name: Upload macOS artifact | ||
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | ||
| with: | ||
| name: release-macos | ||
| path: dist/*.dmg | ||
| retention-days: 1 | ||
|
|
||
| # Create GitHub Release | ||
| release: | ||
| needs: [check-version, build-windows, build-linux, build-macos] | ||
| if: needs.check-version.outputs.should_release == 'true' | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| concurrency: | ||
| group: release-${{ needs.check-version.outputs.tag }} | ||
| cancel-in-progress: false | ||
|
|
||
| steps: | ||
| - name: Download Windows artifact | ||
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | ||
| with: | ||
| name: release-windows | ||
| path: artifacts/windows | ||
|
|
||
| - name: Download Linux artifact | ||
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | ||
| with: | ||
| name: release-linux | ||
| path: artifacts/linux | ||
|
|
||
| - name: Download macOS artifact | ||
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | ||
| with: | ||
| name: release-macos | ||
| path: artifacts/macos | ||
|
|
||
| - name: Create GitHub Release | ||
| uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8 # v2.3.2 | ||
| with: | ||
| tag_name: ${{ needs.check-version.outputs.tag }} | ||
| name: Rein ${{ needs.check-version.outputs.tag }} | ||
| draft: false | ||
| prerelease: true | ||
| generate_release_notes: true | ||
| files: | | ||
| artifacts/windows/*.exe | ||
| artifacts/linux/*.AppImage | ||
| artifacts/macos/*.dmg | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.