Nightly Build #74
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 Build | |
| on: | |
| schedule: | |
| - cron: "0 6 * * *" # 6 AM UTC daily | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: nightly | |
| cancel-in-progress: true | |
| env: | |
| NODE_OPTIONS: "--max-old-space-size=4096" | |
| GO_VERSION: "1.26" | |
| NODE_VERSION: "24" | |
| PNPM_VERSION: "10" | |
| jobs: | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| # Skip if no commits in the last 24 hours (unless manual dispatch) | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| check-changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should_build: ${{ steps.check.outputs.should_build }} | |
| nightly_version: ${{ steps.check.outputs.nightly_version }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check for recent commits | |
| id: check | |
| shell: bash | |
| run: | | |
| NIGHTLY_VERSION="0.0.0-nightly.$(date -u +%Y%m%d)" | |
| echo "nightly_version=${NIGHTLY_VERSION}" >> "$GITHUB_OUTPUT" | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| echo "should_build=true" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| LAST_COMMIT=$(git log -1 --format=%ct) | |
| NOW=$(date +%s) | |
| DIFF=$((NOW - LAST_COMMIT)) | |
| if [ "$DIFF" -lt 86400 ]; then | |
| echo "should_build=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "should_build=false" >> "$GITHUB_OUTPUT" | |
| echo "No commits in the last 24 hours — skipping nightly build" | |
| fi | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| # macOS (darwin/universal) — sign, notarize, DMG | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| build-macos: | |
| runs-on: macos-latest | |
| needs: check-changes | |
| if: needs.check-changes.outputs.should_build == 'true' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| run_install: | | |
| - args: [] | |
| - args: [--global, typescript] | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache: true | |
| cache-dependency-path: "go.sum" | |
| - name: Install Task | |
| uses: arduino/setup-task@v2 | |
| with: | |
| version: 3.x | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install Wails v3 | |
| shell: bash | |
| run: go install github.com/wailsapp/wails/v3/cmd/wails3@latest | |
| - name: Build frontend | |
| shell: bash | |
| run: task common:build:frontend | |
| - name: Build Omniview | |
| shell: bash | |
| env: | |
| CGO_ENABLED: "1" | |
| CGO_CFLAGS: "-mmacosx-version-min=10.15" | |
| CGO_LDFLAGS: "-mmacosx-version-min=10.15" | |
| MACOSX_DEPLOYMENT_TARGET: "10.15" | |
| run: | | |
| go build -tags production -trimpath -buildvcs=false \ | |
| -ldflags "-w -s \ | |
| -X github.com/omniviewdev/omniview/internal/version.Version=${{ needs.check-changes.outputs.nightly_version }} \ | |
| -X github.com/omniviewdev/omniview/internal/version.GitCommit=${{ github.sha }} \ | |
| -X github.com/omniviewdev/omniview/internal/version.BuildDate=$(date -u +%Y-%m-%dT%H:%M:%SZ) \ | |
| -X github.com/omniviewdev/omniview/internal/version.Development=true \ | |
| -X github.com/omniviewdev/omniview/internal/telemetry.buildOTLPEndpoint=${{ secrets.TELEMETRY_OTLP_ENDPOINT }} \ | |
| -X github.com/omniviewdev/omniview/internal/telemetry.buildPyroscopeEndpoint=${{ secrets.TELEMETRY_PYROSCOPE_ENDPOINT }} \ | |
| -X github.com/omniviewdev/omniview/internal/appstate.buildStateDir=~/.omniview-nightly" \ | |
| -o bin/Omniview . | |
| - name: Create macOS .app bundle | |
| run: | | |
| task common:generate:icons | |
| mkdir -p bin/Omniview.app/Contents/MacOS | |
| mkdir -p bin/Omniview.app/Contents/Resources | |
| cp build/darwin/icons.icns bin/Omniview.app/Contents/Resources/ | |
| cp bin/Omniview bin/Omniview.app/Contents/MacOS/ | |
| cp build/darwin/Info.plist bin/Omniview.app/Contents/ | |
| - name: Import Code-Signing Certificates | |
| uses: Apple-Actions/import-codesign-certs@v3 | |
| with: | |
| p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }} | |
| p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }} | |
| - name: Sign and Notarize | |
| shell: bash | |
| env: | |
| APPLE_SIGN_ID: ${{ secrets.APPLE_DEVELOPER_SIGN_ID }} | |
| NOTARY_USER: ${{ secrets.CLI_MACOS_NOTARY_USER }} | |
| NOTARY_PWD: ${{ secrets.CLI_MACOS_NOTARY_PWD }} | |
| TEAM_ID: ${{ secrets.CLI_MACOS_TEAM_ID }} | |
| run: | | |
| codesign --deep --force \ | |
| --options runtime \ | |
| --entitlements build/darwin/entitlements.plist \ | |
| --sign "$APPLE_SIGN_ID" \ | |
| bin/Omniview.app | |
| ditto -c -k --keepParent --rsrc bin/Omniview.app archive.zip | |
| xcrun notarytool submit archive.zip \ | |
| --apple-id "$NOTARY_USER" \ | |
| --password "$NOTARY_PWD" \ | |
| --team-id "$TEAM_ID" \ | |
| --wait | |
| xcrun stapler staple bin/Omniview.app | |
| - name: Checkout create-dmg | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: create-dmg/create-dmg | |
| path: ./build/create-dmg | |
| ref: master | |
| - name: Create DMG | |
| shell: bash | |
| working-directory: ./build | |
| run: | | |
| VERSION="${{ needs.check-changes.outputs.nightly_version }}" | |
| ../build/create-dmg/create-dmg \ | |
| --no-internet-enable \ | |
| --volname "Omniview Nightly" \ | |
| --text-size 12 \ | |
| --window-pos 400 400 \ | |
| --window-size 660 450 \ | |
| --icon-size 80 \ | |
| --icon "Omniview.app" 180 180 \ | |
| --hide-extension "Omniview.app" \ | |
| --app-drop-link 480 180 \ | |
| "../bin/Omniview_${VERSION}_darwin_universal.dmg" \ | |
| "../bin" | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nightly-macos-dmg | |
| path: bin/Omniview_${{ needs.check-changes.outputs.nightly_version }}_darwin_universal.dmg | |
| if-no-files-found: error | |
| retention-days: 1 | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| # Linux (linux/amd64) | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| build-linux: | |
| runs-on: ubuntu-latest | |
| needs: check-changes | |
| if: needs.check-changes.outputs.should_build == 'true' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install Linux dependencies | |
| uses: awalsh128/cache-apt-pkgs-action@latest | |
| with: | |
| packages: libgtk-3-dev libwebkit2gtk-4.1-dev libwayland-dev build-essential pkg-config | |
| version: 1.0 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| run_install: | | |
| - args: [] | |
| - args: [--global, typescript] | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache: true | |
| cache-dependency-path: "go.sum" | |
| - name: Install Task | |
| uses: arduino/setup-task@v2 | |
| with: | |
| version: 3.x | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install Wails v3 | |
| run: go install github.com/wailsapp/wails/v3/cmd/wails3@latest | |
| - name: Build frontend | |
| run: task common:build:frontend | |
| - name: Build Omniview | |
| run: | | |
| go build -tags "production,webkit2_41" -trimpath -buildvcs=false \ | |
| -ldflags "-w -s \ | |
| -X github.com/omniviewdev/omniview/internal/version.Version=${{ needs.check-changes.outputs.nightly_version }} \ | |
| -X github.com/omniviewdev/omniview/internal/version.GitCommit=${{ github.sha }} \ | |
| -X github.com/omniviewdev/omniview/internal/version.BuildDate=$(date -u +%Y-%m-%dT%H:%M:%SZ) \ | |
| -X github.com/omniviewdev/omniview/internal/version.Development=true \ | |
| -X github.com/omniviewdev/omniview/internal/telemetry.buildOTLPEndpoint=${{ secrets.TELEMETRY_OTLP_ENDPOINT }} \ | |
| -X github.com/omniviewdev/omniview/internal/telemetry.buildPyroscopeEndpoint=${{ secrets.TELEMETRY_PYROSCOPE_ENDPOINT }} \ | |
| -X github.com/omniviewdev/omniview/internal/appstate.buildStateDir=~/.omniview-nightly" \ | |
| -o bin/Omniview . | |
| - name: Rename executable | |
| working-directory: ./bin | |
| run: mv Omniview "Omniview_${{ needs.check-changes.outputs.nightly_version }}_linux_amd64" | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nightly-linux-binary | |
| path: bin/Omniview_${{ needs.check-changes.outputs.nightly_version }}_linux_amd64 | |
| if-no-files-found: error | |
| retention-days: 1 | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| # Windows (windows/amd64) | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| build-windows: | |
| runs-on: windows-latest | |
| needs: check-changes | |
| if: needs.check-changes.outputs.should_build == 'true' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| run_install: | | |
| - args: [] | |
| - args: [--global, typescript] | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache: true | |
| cache-dependency-path: "go.sum" | |
| - name: Install Task | |
| uses: arduino/setup-task@v2 | |
| with: | |
| version: 3.x | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install Wails v3 | |
| shell: bash | |
| run: go install github.com/wailsapp/wails/v3/cmd/wails3@latest | |
| - name: Build frontend | |
| shell: bash | |
| run: task common:build:frontend | |
| - name: Build Omniview | |
| shell: bash | |
| run: | | |
| go build -tags production -trimpath -buildvcs=false \ | |
| -ldflags "-w -s -H windowsgui \ | |
| -X github.com/omniviewdev/omniview/internal/version.Version=${{ needs.check-changes.outputs.nightly_version }} \ | |
| -X github.com/omniviewdev/omniview/internal/version.GitCommit=${{ github.sha }} \ | |
| -X github.com/omniviewdev/omniview/internal/version.BuildDate=$(date -u +%Y-%m-%dT%H:%M:%SZ) \ | |
| -X github.com/omniviewdev/omniview/internal/version.Development=true \ | |
| -X github.com/omniviewdev/omniview/internal/telemetry.buildOTLPEndpoint=${{ secrets.TELEMETRY_OTLP_ENDPOINT }} \ | |
| -X github.com/omniviewdev/omniview/internal/telemetry.buildPyroscopeEndpoint=${{ secrets.TELEMETRY_PYROSCOPE_ENDPOINT }} \ | |
| -X github.com/omniviewdev/omniview/internal/appstate.buildStateDir=~/.omniview-nightly" \ | |
| -o bin/Omniview.exe . | |
| - name: Rename executable | |
| working-directory: ./bin | |
| run: Rename-Item -Path "Omniview.exe" -NewName "Omniview_${{ needs.check-changes.outputs.nightly_version }}_windows_amd64.exe" | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nightly-windows-binary | |
| path: bin/Omniview_${{ needs.check-changes.outputs.nightly_version }}_windows_amd64.exe | |
| if-no-files-found: error | |
| retention-days: 1 | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| # NPM — publish @omniviewdev/* nightly packages | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| publish-npm: | |
| needs: check-changes | |
| if: needs.check-changes.outputs.should_build == 'true' | |
| uses: ./.github/workflows/npm-publish.yml | |
| with: | |
| version: ${{ needs.check-changes.outputs.nightly_version }} | |
| dist-tag: nightly | |
| secrets: | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| # Publish nightly — rolling tag | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| publish-nightly: | |
| runs-on: ubuntu-latest | |
| needs: [check-changes, build-macos, build-linux, build-windows] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Collect release assets | |
| shell: bash | |
| run: | | |
| mkdir -p release | |
| cp artifacts/nightly-macos-dmg/*.dmg release/ | |
| cp artifacts/nightly-linux-binary/* release/ | |
| cp artifacts/nightly-windows-binary/*.exe release/ | |
| - name: Generate checksums | |
| shell: bash | |
| working-directory: release | |
| run: sha256sum * > checksums_sha256.txt | |
| - name: Delete previous nightly release | |
| shell: bash | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release delete nightly --yes --cleanup-tag 2>/dev/null || true | |
| - name: Create nightly release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: nightly | |
| name: "Nightly Build (${{ needs.check-changes.outputs.nightly_version }})" | |
| body: | | |
| Automated nightly build from `main` branch. | |
| **Version**: `${{ needs.check-changes.outputs.nightly_version }}` | |
| **Commit**: ${{ github.sha }} | |
| > These builds are for testing purposes and may be unstable. | |
| > | |
| > Install via Homebrew: `brew install --cask omniviewdev/tap/omniview-nightly` | |
| files: release/* | |
| prerelease: true | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Update Homebrew Nightly Cask | |
| shell: bash | |
| env: | |
| HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} | |
| run: | | |
| if [ -z "$HOMEBREW_TAP_TOKEN" ]; then | |
| echo "::warning::HOMEBREW_TAP_TOKEN not set, skipping Homebrew nightly update" | |
| exit 0 | |
| fi | |
| VERSION="${{ needs.check-changes.outputs.nightly_version }}" | |
| DMG_FILE="release/Omniview_${VERSION}_darwin_universal.dmg" | |
| SHA256=$(sha256sum "$DMG_FILE" | awk '{print $1}') | |
| git clone "https://x-access-token:${HOMEBREW_TAP_TOKEN}@github.com/omniviewdev/homebrew-tap.git" tap | |
| cd tap | |
| sed -i "s/version \".*\"/version \"${VERSION}\"/" Casks/omniview-nightly.rb | |
| sed -i "s/sha256 \".*\"/sha256 \"${SHA256}\"/" Casks/omniview-nightly.rb | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add Casks/omniview-nightly.rb | |
| git diff --cached --quiet && echo "No changes to commit" && exit 0 | |
| git commit -m "Update omniview-nightly to ${VERSION}" | |
| git push |