- .github/workflows/release.yml: on tag push, build exe via ps2exe, package portable zip, attach SHA-256, create GitHub Release. - CHANGELOG.md: Keep a Changelog format, semver. - .github/ISSUE_TEMPLATE/: bug_report.yml + feature_request.yml + config.yml routing security reports to private advisories.
77 lines
2.4 KiB
YAML
77 lines
2.4 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*.*.*'
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Resolve version from tag
|
|
id: ver
|
|
shell: bash
|
|
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Install ps2exe
|
|
shell: pwsh
|
|
run: Install-Module -Name ps2exe -Scope CurrentUser -Force -AllowClobber
|
|
|
|
- name: Build executable
|
|
shell: pwsh
|
|
run: |
|
|
Import-Module ps2exe
|
|
$ver = '${{ steps.ver.outputs.version }}'
|
|
Invoke-ps2exe -inputFile netswitch.ps1 -outputFile netswitch.exe `
|
|
-title "netswitch" -description "NIC IP/DHCP toggle - made by engelgardt" `
|
|
-company "engelgardt" -version "$ver.0" `
|
|
-requireAdmin
|
|
|
|
- name: Package portable folder
|
|
shell: pwsh
|
|
run: |
|
|
$ver = '${{ steps.ver.outputs.version }}'
|
|
$folder = "netswitch-v$ver"
|
|
New-Item -ItemType Directory -Path $folder | Out-Null
|
|
Copy-Item netswitch.exe $folder/
|
|
@"
|
|
netswitch v$ver - portable edition
|
|
made by engelgardt
|
|
|
|
Quickly set a Windows network adapter to a static IP or back to DHCP.
|
|
|
|
USAGE
|
|
Double-click netswitch.exe.
|
|
Accept the UAC prompt.
|
|
Pick the NIC, then choose mode (Static / DHCP).
|
|
Press Enter to exit.
|
|
|
|
NOTES
|
|
- Nothing is installed. Delete the folder to remove.
|
|
- Requires Windows 10/11.
|
|
- PowerShell is bundled into the exe via ps2exe; nothing extra needed.
|
|
"@ | Out-File -FilePath "$folder/README.txt" -Encoding UTF8
|
|
Compress-Archive -Path $folder -DestinationPath "netswitch-portable-v$ver.zip"
|
|
|
|
- name: Generate SHA-256 checksum
|
|
shell: pwsh
|
|
run: |
|
|
$ver = '${{ steps.ver.outputs.version }}'
|
|
$zip = "netswitch-portable-v$ver.zip"
|
|
$hash = (Get-FileHash -Algorithm SHA256 $zip).Hash.ToLower()
|
|
"$hash $zip" | Out-File -FilePath "$zip.sha256" -Encoding ASCII -NoNewline
|
|
Get-Content "$zip.sha256"
|
|
|
|
- name: Create release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: |
|
|
netswitch-portable-v${{ steps.ver.outputs.version }}.zip
|
|
netswitch-portable-v${{ steps.ver.outputs.version }}.zip.sha256
|
|
generate_release_notes: true
|