Release #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
tags: | |
- v* | |
workflow_dispatch: | |
env: | |
FORCE_COLOR: true | |
jobs: | |
build-linux: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.23" | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install Linux dependencies | |
run: | | |
sudo apt update | |
sudo apt install -y build-essential libgtk-3-dev xorg-dev | |
- name: Install Go dependencies | |
run: go get -v | |
- name: Build | |
run: CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -v -tags static -ldflags "-s -w" | |
- name: Update executable | |
run: | | |
chmod +x shelter-installer | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: installer-linux | |
path: shelter-installer | |
build-mac: | |
runs-on: macos-latest | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.23" | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: brew install create-dmg | |
- name: Install Go dependencies | |
run: go get -v | |
- name: Build | |
run: CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -o installer-x86 -v -tags static -ldflags "-s -w" | |
- name: Build ARM | |
run: CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -o installer-arm64 -v -tags static -ldflags "-s -w" | |
- name: Lipo (create universal binary) | |
run: lipo installer-arm64 installer-x86 -output shelter-installer -create | |
- name: Create .app folder | |
run: | | |
mkdir -p "Install shelter.app/Contents/MacOS" | |
mkdir "Install shelter.app/Contents/Resources" | |
cp assets/mac-icon.icns "Install shelter.app/Contents/Resources/icon.icns" | |
cp shelter-installer "Install shelter.app/Contents/MacOS" | |
cat > "Install shelter.app/Contents/Info.plist" <<EOF | |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>CFBundleName</key> | |
<string>Install shelter</string> | |
<key>CFBundleExecutable</key> | |
<string>shelter-installer</string> | |
<key>CFBundleIdentifier</key> | |
<string>network.uwu.shelter-installer</string> | |
<key>CFBundleIconFile</key> | |
<string>icon.icns</string> | |
<key>CFBundleShortVersionString</key> | |
<string>2.0.0</string> | |
<key>CFBundleSupportedPlatforms</key> | |
<array> | |
<string>MacOSX</string> | |
</array> | |
<key>CFBundleVersion</key> | |
<string>1</string> | |
<key>NSHighResolutionCapable</key> | |
<true/> | |
<key>NSSupportsAutomaticGraphicsSwitching</key> | |
<true/> | |
<key>CFBundleInfoDictionaryVersion</key> | |
<string>6.0</string> | |
<key>CFBundlePackageType</key> | |
<string>APPL</string> | |
<key>LSApplicationCategoryType</key> | |
<string>public.app-category.</string> | |
<key>LSMinimumSystemVersion</key> | |
<string>10.11</string> | |
</dict> | |
</plist> | |
EOF | |
- name: Create DMG folder | |
run: | | |
mkdir -p shelter-installer-dir | |
mv Install\ shelter.app shelter-installer-dir | |
- name: Create DMG | |
run: create-dmg --background assets/shelter-bg.png --volname shelter --window-size 500 350 --icon "Install shelter.app" 250 135 "Install shelter.dmg" shelter-installer-dir | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: installer-macos | |
path: Install shelter.dmg | |
build-windows: | |
runs-on: windows-latest | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.23" | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup MSYS2 | |
uses: msys2/setup-msys2@v2 | |
- name: Install Windows dependencies | |
shell: msys2 {0} | |
run: | | |
pacman -S --noconfirm git mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL2 mingw-w64-x86_64-go | |
export GOROOT=/mingw64/lib/go | |
export GOPATH=/mingw64 | |
- name: Install Go dependencies | |
shell: msys2 {0} | |
run: | | |
export GOROOT=/mingw64/lib/go | |
export GOPATH=/mingw64 | |
go get -v | |
- name: Build | |
shell: msys2 {0} | |
run: | | |
export GOROOT=/mingw64/lib/go | |
export GOPATH=/mingw64 | |
CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -o install-shelter.exe -v -tags static -ldflags "-s -w -H=windowsgui" | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: installer-windows | |
path: install-shelter.exe | |
release: | |
runs-on: ubuntu-latest | |
needs: [build-linux, build-mac, build-windows] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: installer-linux | |
path: linux | |
- uses: actions/download-artifact@v4 | |
with: | |
name: installer-macos | |
path: macos | |
- uses: actions/download-artifact@v4 | |
with: | |
name: installer-windows | |
path: windows | |
- name: Get some values needed for the release | |
id: release_values | |
run: | | |
echo "date=$(date '+%Y-%m-%d')" >> $GITHUB_OUTPUT | |
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
- name: Create the release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
name: ${{ steps.release_values.outputs.tag }}, ${{ steps.release_values.outputs.date }} | |
draft: true | |
prerelease: false | |
body_path: .github/release_body_template.md | |
files: | | |
linux/install-shelter | |
macos/Install shelter.dmg | |
windows/install-shelter.exe |