-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
32 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,47 +1,61 @@ | ||
name: Build | ||
on: [push, pull_request] | ||
name: Build and Release Electron App | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build_on_win: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@master | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 19 | ||
- name: install dependencies | ||
node-version: 14 # Adjust Node.js version as per your project | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
- name: build | ||
|
||
- name: Build Electron app for Windows | ||
run: npm run electron:package:win | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Publish Artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: Electron-app | ||
path: | | ||
dist/*.exe | ||
path: dist/*.exe | ||
|
||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
tag_name: v1.0.0 # Replace with your desired tag name | ||
release_name: Release v1.0.0 # Replace with your desired release name | ||
body: | | ||
Changes in this Release | ||
- First Change | ||
- Second Change | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Upload Release Asset | ||
id: upload-release-asset | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | ||
asset_path: ./my-artifact.zip | ||
asset_name: my-artifact.zip | ||
asset_content_type: application/zip | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: dist/*.exe # Path to the artifact | ||
asset_name: electron-app-windows.exe # Name of the asset | ||
asset_content_type: application/octet-stream |