Nightly #59
This file contains hidden or 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: Nightly | |
| on: | |
| workflow_run: | |
| workflows: ["CI"] | |
| branches: [main] | |
| types: [completed] | |
| permissions: | |
| contents: write | |
| jobs: | |
| nightly-macos: | |
| name: macOS (Universal) | |
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0 | |
| with: | |
| go-version-file: go.mod | |
| - name: Install Task | |
| uses: go-task/setup-task@70f2430ad412f838533de8c0515c749ffb2b8bd3 # v1.1.0 | |
| - name: Package macOS universal .app | |
| run: task package-darwin-universal | |
| - name: Verify macOS package | |
| run: bin/Biomelab.app/Contents/MacOS/Biomelab --version | |
| - name: Create zip | |
| run: cd bin && zip -r Biomelab-darwin-universal.zip Biomelab.app | |
| - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: biomelab-nightly-darwin | |
| path: bin/Biomelab-darwin-universal.zip | |
| nightly-linux: | |
| name: Linux (amd64) | |
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0 | |
| with: | |
| go-version-file: go.mod | |
| - name: Install system dependencies | |
| run: sudo apt-get update -qq && sudo apt-get install -y -qq gcc libgl1-mesa-dev xorg-dev | |
| - name: Install Task | |
| uses: go-task/setup-task@70f2430ad412f838533de8c0515c749ffb2b8bd3 # v1.1.0 | |
| - name: Package Linux | |
| run: task package | |
| - name: Verify Linux package | |
| run: | | |
| mkdir -p /tmp/verify | |
| # fyne tools v1.7.1 wraps the tarball in a top-level | |
| # directory (fyne-io/tools#105) — strip it. | |
| tar -xJf bin/Biomelab.tar.xz -C /tmp/verify --strip-components=1 | |
| /tmp/verify/usr/local/bin/biomelab --version | |
| - name: Prepare artifact | |
| run: | | |
| cd bin | |
| for f in *.tar.xz; do | |
| mv "$f" Biomelab-linux-amd64.tar.xz | |
| done | |
| - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: biomelab-nightly-linux | |
| path: bin/Biomelab-linux-amd64.tar.xz | |
| nightly-windows: | |
| name: Windows (amd64) | |
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| runs-on: windows-latest | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0 | |
| with: | |
| go-version-file: go.mod | |
| - name: Install Task | |
| uses: go-task/setup-task@70f2430ad412f838533de8c0515c749ffb2b8bd3 # v1.1.0 | |
| - name: Package | |
| run: task package | |
| - name: Verify Windows package | |
| run: ./bin/Biomelab.exe --version | |
| - name: Create zip | |
| shell: pwsh | |
| run: Compress-Archive -Path bin/Biomelab.exe -DestinationPath Biomelab-windows-amd64.zip | |
| - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: biomelab-nightly-windows | |
| path: Biomelab-windows-amd64.zip | |
| publish: | |
| name: Publish Nightly | |
| needs: [nightly-macos, nightly-linux, nightly-windows] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| path: artifacts | |
| - name: Compute nightly tag | |
| id: nightly | |
| run: | | |
| BASE=$(git describe --tags --abbrev=0 --match 'v[0-9]*' --exclude '*-nightly*' 2>/dev/null || echo "v0.0.0") | |
| echo "base=${BASE}" >> "$GITHUB_OUTPUT" | |
| echo "tag=${BASE}-nightly" >> "$GITHUB_OUTPUT" | |
| - name: Delete existing nightly tags and releases | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| # Delete every *-nightly release so a stable version bump doesn't | |
| # leave the previous BASE's nightly orphaned. | |
| for tag in $(gh release list --limit 100 --json tagName --jq '.[].tagName' | grep -- '-nightly$' || true); do | |
| echo "Deleting release: $tag" | |
| gh release delete "$tag" --yes --cleanup-tag || true | |
| done | |
| # Also delete orphan *-nightly tags from remote. These accumulate | |
| # when a previous run pushed the tag but `gh release create` | |
| # failed afterwards (e.g. a transient GitHub 504). The release | |
| # loop above can't see them — they have no release attached. | |
| for tag in $(git ls-remote --tags origin | awk '{print $2}' | sed 's#refs/tags/##' | grep -- '-nightly$' || true); do | |
| echo "Deleting orphan tag: $tag" | |
| git push origin ":refs/tags/$tag" || true | |
| done | |
| - name: Create nightly release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NIGHTLY_TAG: ${{ steps.nightly.outputs.tag }} | |
| BASE_TAG: ${{ steps.nightly.outputs.base }} | |
| run: | | |
| SHORT_SHA=$(git rev-parse --short HEAD) | |
| # `gh release create` creates the tag on `--target` atomically | |
| # with the release itself. If this step fails (504, rate limit, | |
| # etc.) no tag is left behind, so the next run starts clean. | |
| gh release create "${NIGHTLY_TAG}" \ | |
| --target "$(git rev-parse HEAD)" \ | |
| --title "Nightly Build (${SHORT_SHA})" \ | |
| --prerelease \ | |
| --generate-notes \ | |
| --notes-start-tag "${BASE_TAG}" \ | |
| artifacts/biomelab-nightly-darwin/Biomelab-darwin-universal.zip \ | |
| artifacts/biomelab-nightly-linux/Biomelab-linux-amd64.tar.xz \ | |
| artifacts/biomelab-nightly-windows/Biomelab-windows-amd64.zip | |
| - name: Update nightly cask | |
| env: | |
| HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }} | |
| NIGHTLY_TAG: ${{ steps.nightly.outputs.tag }} | |
| run: | | |
| VERSION="${NIGHTLY_TAG#v}" | |
| SHA=$(sha256sum artifacts/biomelab-nightly-darwin/Biomelab-darwin-universal.zip | awk '{print $1}') | |
| cat > biomelab-nightly.rb << CASK | |
| cask "biomelab-nightly" do | |
| version "${VERSION}" | |
| sha256 "${SHA}" | |
| url "https://github.com/mdelapenya/biomelab/releases/download/${NIGHTLY_TAG}/Biomelab-darwin-universal.zip" | |
| name "Biomelab Nightly" | |
| desc "BiomeLab (nightly) — a desktop dashboard for git worktrees and coding agents" | |
| homepage "https://github.com/mdelapenya/biomelab" | |
| app "Biomelab.app" | |
| conflicts_with cask: "biomelab" | |
| zap trash: [ | |
| "~/Library/Preferences/com.mdelapenya.biomelab.plist", | |
| "~/.config/biomelab", | |
| ] | |
| end | |
| CASK | |
| cd "$(mktemp -d)" | |
| git clone "https://x-access-token:${HOMEBREW_TAP_GITHUB_TOKEN}@github.com/mdelapenya/homebrew-tap.git" . | |
| mkdir -p Casks | |
| cp "${GITHUB_WORKSPACE}/biomelab-nightly.rb" Casks/biomelab-nightly.rb | |
| git add Casks/biomelab-nightly.rb | |
| if git diff --cached --quiet; then | |
| echo "No changes to cask file." | |
| else | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git commit -m "Update biomelab-nightly cask to ${VERSION}" | |
| git push | |
| fi |