Skip to content
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

Enhances the Build and Release #44

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Build and Release

on:
push:
branches:
- main
tags:
- 'v*.*.*'

jobs:
build:
runs-on: windows-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install PS2EXE
shell: pwsh
run: |
pwsh -Command "Install-Module ps2exe -Force -Scope CurrentUser"

- name: Convert PowerShell to EXE
shell: pwsh
run: |
pwsh -Command "try {
Invoke-ps2exe -InputFile './Winhance.ps1' -OutputFile './Winhance.exe' -NoConsole -IconFile './Winhance.ico'
} catch {
Write-Error 'Failed to convert PowerShell script to EXE: $($_.Exception.Message)'
Write-Error 'Exception details: $($_.Exception | Format-List * -Force | Out-String)'
exit 1
}"

- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: Winhance-EXE
path: Winhance.exe

- name: Generate Release Notes
id: generate_release_notes
shell: pwsh
run: |
$releaseNotes = "Release notes for ${{ github.ref_name }}"
echo "release_notes=$releaseNotes" >> $env:GITHUB_OUTPUT

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
draft: false
prerelease: false
body: ${{ steps.generate_release_notes.outputs.release_notes }}

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: Winhance.exe
asset_name: Winhance.exe
asset_content_type: application/vnd.microsoft.portable-executable
Binary file added Winhance.ico
Binary file not shown.