Picocrypt/.github/workflows/build-windows.yml
2024-06-18 21:02:02 -04:00

62 lines
1.7 KiB
YAML

name: build-windows
on:
push:
paths:
- "src/*.go"
- "src/go.mod"
- "src/go.sum"
workflow_dispatch:
jobs:
build:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '>=1.22'
check-latest: true
cache: false
- name: Install dependencies
run: |
cd src
go mod download
- name: Build
run: |
cd src
go build -ldflags="-s -w -H=windowsgui -extldflags=-static" -o out.exe Picocrypt.go
env:
CGO_ENABLED: 1
- name: Add icon and manifest
shell: pwsh
run: |
Invoke-WebRequest -OutFile reshacker_setup.zip https://github.com/user-attachments/files/15893917/reshacker_setup.zip
Expand-Archive -DestinationPath reshacker_setup reshacker_setup.zip
reshacker_setup/reshacker_setup.exe /SILENT
Start-Process -NoNewWindow -FilePath "$P" -ArgumentList "-open out.exe","-save new.exe","-action add","-res images/key.ico","-mask ICONGROUP,MAINICON,"
Start-Sleep -Seconds 10
del Picocrypt.exe
mv new.exe Picocrypt.exe
env:
P: "C:\\Program Files (x86)\\Resource Hacker\\ResourceHacker.exe"
- name: Compress with upx
shell: pwsh
run: |
Invoke-WebRequest -OutFile upx.zip https://github.com/upx/upx/releases/download/v4.2.4/upx-4.2.4-win64.zip
Expand-Archive upx.zip -DestinationPath upx
upx/upx-4.2.4-win64/upx.exe --lzma --brute src/Picocrypt.exe
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: build-windows
path: src/Picocrypt.exe
if-no-files-found: error
compression-level: 9