|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*" |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + release: |
| 13 | + runs-on: macos-14 |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v7 |
| 16 | + - uses: actions/setup-python@v7 |
| 17 | + with: |
| 18 | + python-version: "3.14" |
| 19 | + |
| 20 | + - name: Verify tag and version |
| 21 | + shell: bash |
| 22 | + run: | |
| 23 | + set -euo pipefail |
| 24 | + version="$(cat VERSION)" |
| 25 | + test "$GITHUB_REF_NAME" = "v$version" |
| 26 | + PYTHONPATH=src python -c 'import agent_switch; print(agent_switch.__version__)' |
| 27 | +
|
| 28 | + - name: Run release tests |
| 29 | + run: | |
| 30 | + PYTHONPATH=src python -m unittest discover -s tests -v |
| 31 | + PYTHONPATH=src python -m unittest discover -s tests/integration -v |
| 32 | +
|
| 33 | + - name: Build release artifacts |
| 34 | + run: | |
| 35 | + python -m pip install --upgrade build |
| 36 | + python -m build --sdist --outdir dist |
| 37 | + ./scripts/build-release.sh dist |
| 38 | + cd dist |
| 39 | + shasum -a 256 "agent_switch-$(cat ../VERSION).tar.gz" \ |
| 40 | + > "agent_switch-$(cat ../VERSION).tar.gz.sha256" |
| 41 | +
|
| 42 | + - name: Create GitHub prerelease |
| 43 | + env: |
| 44 | + GH_TOKEN: ${{ github.token }} |
| 45 | + shell: bash |
| 46 | + run: | |
| 47 | + set -euo pipefail |
| 48 | + version="$(cat VERSION)" |
| 49 | + cat > "$RUNNER_TEMP/release-notes.md" <<EOF |
| 50 | + Agent Switch $version is an alpha release for macOS 14 and newer. |
| 51 | +
|
| 52 | + ## Install |
| 53 | +
|
| 54 | + \`\`\`bash |
| 55 | + brew tap JNHFlow21/tap && brew trust --tap JNHFlow21/tap && HOMEBREW_CASK_OPTS=--no-quarantine brew install --cask JNHFlow21/tap/agent-switch |
| 56 | + \`\`\` |
| 57 | +
|
| 58 | + This build is ad-hoc signed and not notarized because the project does |
| 59 | + not yet have an Apple Developer ID. The install command deliberately |
| 60 | + disables Gatekeeper quarantine for this cask installation. Review the |
| 61 | + public source and checksums before installing. |
| 62 | + EOF |
| 63 | + gh release create "$GITHUB_REF_NAME" \ |
| 64 | + dist/Agent-Switch-"$version"-macos-universal.zip \ |
| 65 | + dist/Agent-Switch-"$version"-macos-universal.zip.sha256 \ |
| 66 | + dist/agent_switch-"$version".tar.gz \ |
| 67 | + dist/agent_switch-"$version".tar.gz.sha256 \ |
| 68 | + --title "Agent Switch $version" \ |
| 69 | + --notes-file "$RUNNER_TEMP/release-notes.md" \ |
| 70 | + --prerelease |
0 commit comments