mirror of
https://github.com/Picocrypt/Picocrypt.git
synced 2025-05-12 21:58:31 +02:00
81 lines
1.8 KiB
YAML
81 lines
1.8 KiB
YAML
name: build-macos
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- "VERSION"
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: macos-15
|
|
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 packages
|
|
run: |
|
|
brew install glfw glew
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
cd src
|
|
go mod download
|
|
|
|
- name: Build
|
|
run: |
|
|
cd src
|
|
go build -v -ldflags="-s -w" -o Picocrypt Picocrypt.go
|
|
env:
|
|
CGO_ENABLED: 1
|
|
|
|
- name: Package as .app in a .dmg
|
|
run: |
|
|
mv dist/macos/Picocrypt.app.zip .
|
|
unzip -d Picocrypt.app Picocrypt.app.zip
|
|
rm Picocrypt.app.zip
|
|
mv src/Picocrypt Picocrypt.app/Contents/MacOS/Picocrypt
|
|
mkdir out
|
|
cp -R Picocrypt.app out
|
|
hdiutil create Picocrypt.dmg -volname Picocrypt -fs APFS -format UDZO -srcfolder out
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: build-macos
|
|
path: |
|
|
Picocrypt.dmg
|
|
if-no-files-found: error
|
|
compression-level: 9
|
|
|
|
- name: Get version tag
|
|
run: |
|
|
VERSION=$(cat VERSION)
|
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
|
|
|
- name: Generate checksums
|
|
run: |
|
|
HASH=$(shasum -a 256 Picocrypt.dmg | cut -d ' ' -f1)
|
|
echo "CHECKSUM_PICOCRYPT=$HASH" >> $GITHUB_ENV
|
|
|
|
- name: Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: |
|
|
Picocrypt.dmg
|
|
tag_name: ${{ env.VERSION }}
|
|
make_latest: true
|
|
append_body: true
|
|
body: |
|
|
`sha256(Picocrypt.dmg) ${{ env.CHECKSUM_PICOCRYPT }}`
|