release: 0.26.1 — Codex weekly-only payload fix and Antigravity offic… #138
Workflow file for this run
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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Existing tag to (re)build, e.g. v0.1.1' | |
| required: true | |
| type: string | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| runs-on: macos-latest | |
| steps: | |
| - name: Resolve ref | |
| id: ref | |
| run: | | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| echo "ref=${{ inputs.tag }}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "ref=${{ github.ref }}" >> "$GITHUB_OUTPUT" | |
| fi | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| ref: ${{ steps.ref.outputs.ref }} | |
| - uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2 | |
| - run: uv python install 3.13 | |
| - run: uv sync --frozen --group dev | |
| - name: Run ruff | |
| run: uv run ruff check . | |
| - name: Run mypy | |
| run: uv run mypy . | |
| - name: Run pytest | |
| run: uv run pytest -v | |
| build: | |
| needs: test | |
| runs-on: macos-latest | |
| permissions: | |
| contents: write | |
| outputs: | |
| tag: ${{ steps.ref.outputs.tag }} | |
| steps: | |
| - name: Resolve ref and tag | |
| id: ref | |
| run: | | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| echo "ref=${{ inputs.tag }}" >> "$GITHUB_OUTPUT" | |
| echo "tag=${{ inputs.tag }}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "ref=${{ github.ref }}" >> "$GITHUB_OUTPUT" | |
| echo "tag=${{ github.ref_name }}" >> "$GITHUB_OUTPUT" | |
| fi | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| ref: ${{ steps.ref.outputs.ref }} | |
| - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 | |
| with: | |
| python-version: '3.13' | |
| - uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2 | |
| - name: Build .app | |
| env: | |
| # py2app needs a Python build where extension modules like zlib are | |
| # real .so files with a __file__ (so it can copy them into the | |
| # bundle). uv's own downloaded interpreter builds some stdlib | |
| # extensions as built-ins with no __file__, which crashes py2app. | |
| # Force uv to use the actions/setup-python interpreter instead of | |
| # downloading its own. | |
| INSTATE_CLI_TOKEN: ${{ secrets.INSTATE_CLI_TOKEN }} | |
| UV_PYTHON_PREFERENCE: only-system | |
| run: ./scripts/build_app.sh | |
| - name: Verify .app bundle contents | |
| run: | | |
| set -e | |
| if [[ -d dist/main.app && ! -d dist/usage.app ]]; then | |
| mv dist/main.app dist/usage.app | |
| fi | |
| dump_resources() { | |
| echo "Contents/Resources listing:" | |
| ls -lR dist/usage.app/Contents/Resources | head -50 || true | |
| } | |
| verify_file() { | |
| if [[ ! -f "$1" ]]; then | |
| echo "Missing required bundle file: $1" | |
| dump_resources | |
| exit 1 | |
| fi | |
| } | |
| if [[ ! -d dist/usage.app ]]; then | |
| echo "Missing app bundle: dist/usage.app" | |
| ls -l dist || true | |
| exit 1 | |
| fi | |
| verify_file dist/usage.app/Contents/Resources/usage_statusline.py | |
| verify_file dist/usage.app/Contents/Resources/claude.webp | |
| verify_file dist/usage.app/Contents/Resources/codex.webp | |
| verify_file dist/usage.app/Contents/Info.plist | |
| - name: Zip .app | |
| run: | | |
| cd dist && zip -r usage.app.zip usage.app | |
| - name: Generate SHA256 | |
| run: | | |
| cd dist && shasum -a 256 usage.app.zip | tee usage.app.zip.sha256 | |
| - name: Extract release notes from CHANGELOG.md | |
| id: notes | |
| run: | | |
| TAG="${{ steps.ref.outputs.tag }}" | |
| VERSION="${TAG#v}" | |
| NOTES_FILE="$(mktemp)" | |
| awk -v v="$VERSION" ' | |
| $0 ~ "^## \\[" v "\\]" { flag=1; next } | |
| /^## \[/ && flag { exit } | |
| flag { print } | |
| ' CHANGELOG.md > "$NOTES_FILE" | |
| if [[ ! -s "$NOTES_FILE" ]]; then | |
| echo "CHANGELOG.md has no section for [$VERSION]; using empty notes." | |
| fi | |
| echo "path=$NOTES_FILE" >> "$GITHUB_OUTPUT" | |
| - name: Ensure release exists | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| if ! gh release view "${{ steps.ref.outputs.tag }}" >/dev/null 2>&1; then | |
| gh release create \ | |
| "${{ steps.ref.outputs.tag }}" \ | |
| --target "${{ github.sha }}" \ | |
| --title "${{ steps.ref.outputs.tag }}" \ | |
| --notes-file "${{ steps.notes.outputs.path }}" | |
| fi | |
| - name: Upload to release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: gh release upload "${{ steps.ref.outputs.tag }}" dist/usage.app.zip dist/usage.app.zip.sha256 --clobber | |
| bump-homebrew: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Ensure tap token present | |
| env: | |
| TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} | |
| run: | | |
| if [[ -z "$TOKEN" ]]; then | |
| echo "::error::HOMEBREW_TAP_TOKEN secret is not set; cannot update Homebrew tap." >&2 | |
| exit 1 | |
| fi | |
| - name: Checkout tap repo | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| repository: aqua5230/homebrew-usage | |
| token: ${{ secrets.HOMEBREW_TAP_TOKEN }} | |
| - name: Download release checksum | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh release download "${{ needs.build.outputs.tag }}" \ | |
| --repo aqua5230/usage \ | |
| --pattern usage.app.zip.sha256 \ | |
| --output checksum.txt | |
| - name: Update cask | |
| run: | | |
| TAG="${{ needs.build.outputs.tag }}" | |
| VERSION="${TAG#v}" | |
| SHA="$(awk '{print $1}' checksum.txt)" | |
| if [[ -z "$SHA" ]]; then | |
| echo "::error::Could not read sha256 from release checksum." >&2 | |
| exit 1 | |
| fi | |
| # url is derived from version via v#{version} interpolation, so only | |
| # version + sha256 need bumping (don't sed the url, it would break it). | |
| sed -i \ | |
| -e "s|sha256 \"[0-9a-f]*\"|sha256 \"${SHA}\"|" \ | |
| -e "s|version \"[^\"]*\"|version \"${VERSION}\"|" \ | |
| Casks/usage.rb | |
| - name: Commit and push | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| if git diff --quiet -- Casks/usage.rb; then | |
| echo "Cask already up to date; nothing to commit." | |
| exit 0 | |
| fi | |
| git add Casks/usage.rb | |
| git commit -m "usage ${{ needs.build.outputs.tag }}" | |
| git push |