Picocrypt/.github/workflows/build-windows.yml
2024-06-18 22:01:34 -04:00

64 lines
1.9 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.18'
check-latest: true
cache: false
- name: Install dependencies
run: |
cd src
go mod download
- name: Build
run: |
cd src
go build -v -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-Sleep -Seconds 20
# Invoke-Expression "& `"$Env:P`" -open out.exe -save new.exe -action add -res images/key.ico -mask ICONGROUP,MAINICON,"
Start-Process -NoNewWindow -FilePath "$Env:P" -ArgumentList "-open out.exe -save new.exe -action add -res images/key.ico -mask ICONGROUP,MAINICON, -log CON"
Start-Sleep -Seconds 10
ls
ren 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