Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 0 additions & 39 deletions .github/workflows/auto-tag.yml

This file was deleted.

24 changes: 24 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: release-please

on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest
steps:
# Watches conventional commits on main, opens (and updates) a Release PR
# that bumps .release-please-manifest.json + regenerates CHANGELOG.md.
# When the Release PR is merged, this action creates the git tag (vX.Y.Z)
# and the GitHub Release. The release.yml workflow then triggers on that
# tag to attach prebuilt asset bundles.
- uses: googleapis/release-please-action@v4
with:
config-file: .release-please-config.json
manifest-file: .release-please-manifest.json
105 changes: 50 additions & 55 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,70 +6,65 @@ on:
- 'v*'

jobs:
build:
name: Build (${{ matrix.arch }})
release:
name: Build universal binary, attach to release
runs-on: macos-15
strategy:
matrix:
arch: [arm64, x86_64]

permissions:
contents: write
steps:
- uses: actions/checkout@v6

- name: Build stack-nudge.app
# Stamp the tag's version into Info.plist so the bundled app advertises
# the right version regardless of what's checked into main.
- name: Stamp version from tag
run: |
APP="stack-nudge.app/Contents"
mkdir -p "$APP/MacOS"
swiftc \
notifier/main.swift \
notifier/Config.swift \
notifier/Notifier.swift \
notifier/AppActivator.swift \
-o "$APP/MacOS/stack-nudge" \
-target ${{ matrix.arch }}-apple-macos12.0 \
-framework Foundation \
-framework AppKit \
-framework ScriptingBridge
cp notifier/Info.plist "$APP/Info.plist"
mkdir -p "$APP/Resources"
cp notifier/Icon.icns "$APP/Resources/Icon.icns"
VERSION="${GITHUB_REF_NAME#v}"
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $VERSION" panel/Info.plist
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $VERSION" panel/Info.plist

- name: Verify
run: file stack-nudge.app/Contents/MacOS/stack-nudge
# Build each arch sequentially via swiftc's -target flag (cross-compiles
# fine on macos-15 runners). Stash the per-arch mach-o so we can lipo
# them into a universal binary afterward.
- name: Build arm64
run: bash build.sh arm64
- name: Stash arm64 binary
run: cp build/stack-nudge.app/Contents/MacOS/stack-nudge /tmp/stack-nudge-arm64

- name: Package
run: |
mkdir release
cp -r stack-nudge.app release/
cp notify.sh release/
tar czf stack-nudge-${{ matrix.arch }}.tar.gz release
shasum -a 256 stack-nudge-${{ matrix.arch }}.tar.gz \
| awk '{print $1}' > stack-nudge-${{ matrix.arch }}.sha256

- uses: actions/upload-artifact@v7
with:
name: stack-nudge-${{ matrix.arch }}
path: |
stack-nudge-${{ matrix.arch }}.tar.gz
stack-nudge-${{ matrix.arch }}.sha256
- name: Build x86_64
run: bash build.sh x86_64
- name: Stash x86_64 binary
run: cp build/stack-nudge.app/Contents/MacOS/stack-nudge /tmp/stack-nudge-x86_64

release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
- name: Combine into universal binary
run: |
# The x86_64 build is what's currently in build/, so just replace
# its mach-o with the lipo'd universal one.
lipo -create /tmp/stack-nudge-arm64 /tmp/stack-nudge-x86_64 \
-output build/stack-nudge.app/Contents/MacOS/stack-nudge
# lipo invalidates the per-arch ad-hoc signatures — re-sign the bundle.
codesign --force --deep --sign - build/stack-nudge.app
file build/stack-nudge.app/Contents/MacOS/stack-nudge

steps:
- uses: actions/download-artifact@v8
with:
merge-multiple: true
# Tarball includes the prebuilt bundle plus everything install.sh needs
# at runtime. install.sh skips the build step when build/stack-nudge.app
# is already present, so users who download the release run a fast
# install (no swiftc dependency on the user's machine).
- name: Package
run: |
VERSION="${GITHUB_REF_NAME#v}"
mkdir -p release/build
cp -R build/stack-nudge.app release/build/
cp notify.sh install.sh uninstall.sh notify.conf.example release/
cp -R phrases release/
tar czf "stack-nudge-${VERSION}-universal.tar.gz" -C release .
shasum -a 256 "stack-nudge-${VERSION}-universal.tar.gz" \
| awk '{print $1}' > "stack-nudge-${VERSION}-universal.sha256"

- name: Create GitHub Release
uses: softprops/action-gh-release@v3
# release-please creates the GitHub Release before this workflow runs,
# so action-gh-release attaches assets to the existing release rather
# than creating a duplicate.
- uses: softprops/action-gh-release@v3
with:
generate_release_notes: true
files: |
stack-nudge-arm64.tar.gz
stack-nudge-arm64.sha256
stack-nudge-x86_64.tar.gz
stack-nudge-x86_64.sha256
stack-nudge-*-universal.tar.gz
stack-nudge-*-universal.sha256
12 changes: 12 additions & 0 deletions .release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"release-type": "simple",
"include-component-in-tag": false,
"packages": {
".": {
"package-name": "stack-nudge",
"release-type": "simple",
"changelog-path": "CHANGELOG.md"
}
}
}
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "1.1.2"
}
30 changes: 18 additions & 12 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,30 @@ echo "Installing stack-nudge..."

mkdir -p "$INSTALL_DIR"

# Build and install the native app bundle (single persistent binary).
# build.sh's output (stdout + stderr — Swift emits ~120 lines of UserNotifications
# deprecation warnings on every build) is redirected to a log so the install
# transcript stays scannable. On real build failure the log's last 20 lines
# are dumped so the actual error doesn't get hidden.
# Build (or use a prebuilt) native app bundle. Release tarballs ship with a
# universal binary already at build/stack-nudge.app — in that case skip the
# rebuild so users who download a release don't need swiftc on their machine.
# build.sh's output (Swift emits ~120 lines of UserNotifications deprecation
# warnings on every build) goes to a log so the install transcript stays
# scannable. On real build failure the log's last 20 lines are dumped.
PREBUILT_APP="$SCRIPT_DIR/build/stack-nudge.app"
BUILD_LOG="/tmp/stack-nudge-install-build.log"
if [[ "$(uname -s)" == "Darwin" ]]; then
echo ""
echo "Building stack-nudge.app..."
if ! bash "$SCRIPT_DIR/build.sh" > "$BUILD_LOG" 2>&1; then
echo ""
echo " ✗ Build failed. Last 20 lines of $BUILD_LOG:"
tail -20 "$BUILD_LOG" | sed 's/^/ /'
exit 1
if [[ -d "$PREBUILT_APP" ]]; then
echo "Using prebuilt stack-nudge.app from release bundle..."
else
echo "Building stack-nudge.app..."
if ! bash "$SCRIPT_DIR/build.sh" > "$BUILD_LOG" 2>&1; then
echo ""
echo " ✗ Build failed. Last 20 lines of $BUILD_LOG:"
tail -20 "$BUILD_LOG" | sed 's/^/ /'
exit 1
fi
fi
rm -rf "$HOME/Applications/stack-nudge.app"
rm -rf "$HOME/Applications/stack-nudge-panel.app" # clean up old panel binary
cp -r "$SCRIPT_DIR/build/stack-nudge.app" "$HOME/Applications/stack-nudge.app"
cp -r "$PREBUILT_APP" "$HOME/Applications/stack-nudge.app"
echo " Installed stack-nudge.app -> ~/Applications/stack-nudge.app"
fi

Expand Down