Nightly Build #10
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.24" | |
| NODE_VERSION: "20" | |
| 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 Wails | |
| shell: bash | |
| run: go install github.com/wailsapp/wails/v2/cmd/wails@latest | |
| - name: Build runtime package | |
| shell: bash | |
| run: pnpm run build | |
| working-directory: packages/omniviewdev-runtime | |
| - name: Build Omniview | |
| shell: bash | |
| run: | | |
| wails build -platform darwin/universal \ | |
| -webview2 download \ | |
| -ldflags "\ | |
| -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" | |
| - 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" \ | |
| build/bin/Omniview.app | |
| ditto -c -k --keepParent --rsrc build/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 build/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 }}" | |
| ./create-dmg/create-dmg \ | |
| --no-internet-enable \ | |
| --volname "Omniview Nightly" \ | |
| --volicon "bin/Omniview.app/Contents/Resources/iconfile.icns" \ | |
| --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: build/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 system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev | |
| - 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 Wails | |
| run: go install github.com/wailsapp/wails/v2/cmd/wails@latest | |
| - name: Build runtime package | |
| run: pnpm run build | |
| working-directory: packages/omniviewdev-runtime | |
| - name: Build Omniview | |
| run: | | |
| wails build -platform linux/amd64 \ | |
| -tags webkit2_41 \ | |
| -webview2 download \ | |
| -ldflags "\ | |
| -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" | |
| - name: Rename executable | |
| working-directory: ./build/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: build/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 Wails | |
| shell: bash | |
| run: go install github.com/wailsapp/wails/v2/cmd/wails@latest | |
| - name: Build runtime package | |
| shell: bash | |
| run: pnpm run build | |
| working-directory: packages/omniviewdev-runtime | |
| - name: Build Omniview | |
| shell: bash | |
| run: | | |
| wails build -platform windows/amd64 \ | |
| -webview2 download \ | |
| -ldflags "\ | |
| -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" | |
| - name: Rename executable | |
| working-directory: ./build/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: build/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 |