Skip to content

Commit

Permalink
Update build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTharz committed Jun 15, 2024
1 parent 9941db3 commit 38e1dfa
Showing 1 changed file with 32 additions and 18 deletions.
50 changes: 32 additions & 18 deletions .github/workflows/build.yml
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

0 comments on commit 38e1dfa

Please sign in to comment.