|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*" |
| 7 | + |
| 8 | +concurrency: |
| 9 | + group: release-${{ github.ref }} |
| 10 | + cancel-in-progress: false |
| 11 | + |
| 12 | +jobs: |
| 13 | + publish: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + permissions: |
| 16 | + contents: read |
| 17 | + id-token: write |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Checkout |
| 21 | + uses: actions/checkout@v4 |
| 22 | + |
| 23 | + - name: Setup Python |
| 24 | + uses: actions/setup-python@v5 |
| 25 | + with: |
| 26 | + python-version: "3.12" |
| 27 | + |
| 28 | + - name: Install release tooling |
| 29 | + run: python -m pip install '.[release]' |
| 30 | + |
| 31 | + - name: Derive release version from tag |
| 32 | + env: |
| 33 | + GITHUB_REF_NAME: ${{ github.ref_name }} |
| 34 | + run: | |
| 35 | + case "$GITHUB_REF_NAME" in |
| 36 | + v?*) |
| 37 | + echo "RELEASE_VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV" |
| 38 | + ;; |
| 39 | + *) |
| 40 | + echo "error: expected a tag like v1.2.3, got $GITHUB_REF_NAME" >&2 |
| 41 | + exit 1 |
| 42 | + ;; |
| 43 | + esac |
| 44 | +
|
| 45 | + - name: Build and check distributions |
| 46 | + run: ./scripts/publish_pypi.sh --dry-run --yes --dist-dir dist --version "$RELEASE_VERSION" |
| 47 | + |
| 48 | + - name: Publish to PyPI |
| 49 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 50 | + |
| 51 | + macos: |
| 52 | + runs-on: macos-latest |
| 53 | + permissions: |
| 54 | + contents: write |
| 55 | + |
| 56 | + steps: |
| 57 | + - name: Checkout |
| 58 | + uses: actions/checkout@v4 |
| 59 | + |
| 60 | + - name: Run Core unit tests |
| 61 | + run: swift test --package-path macos |
| 62 | + |
| 63 | + - name: Derive release version from tag |
| 64 | + env: |
| 65 | + GITHUB_REF_NAME: ${{ github.ref_name }} |
| 66 | + run: | |
| 67 | + case "$GITHUB_REF_NAME" in |
| 68 | + v?*) |
| 69 | + echo "RELEASE_VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV" |
| 70 | + ;; |
| 71 | + *) |
| 72 | + echo "error: expected a tag like v1.2.3, got $GITHUB_REF_NAME" >&2 |
| 73 | + exit 1 |
| 74 | + ;; |
| 75 | + esac |
| 76 | +
|
| 77 | + - name: Install create-dmg |
| 78 | + run: brew install create-dmg |
| 79 | + |
| 80 | + - name: Build DMGs (arm64 + x86_64) |
| 81 | + run: | |
| 82 | + set -euo pipefail |
| 83 | + export NEWBRO_APP_VERSION="$RELEASE_VERSION" |
| 84 | + mkdir -p macos/release |
| 85 | + for ARCH in arm64 x86_64; do |
| 86 | + echo "::group::build $ARCH" |
| 87 | + NEWBRO_APP_ARCH="$ARCH" ./macos/package-app.sh |
| 88 | + STAGE="$(mktemp -d)" |
| 89 | + cp -R "macos/dist/Newbro Executor.app" "$STAGE/" |
| 90 | + DMG="macos/release/NewbroExecutor-${NEWBRO_APP_VERSION}-${ARCH}.dmg" |
| 91 | + rm -f "$DMG" |
| 92 | + create-dmg \ |
| 93 | + --volname "Newbro Executor ${NEWBRO_APP_VERSION}" \ |
| 94 | + --window-size 540 380 \ |
| 95 | + --icon-size 128 \ |
| 96 | + --icon "Newbro Executor.app" 140 190 \ |
| 97 | + --app-drop-link 400 190 \ |
| 98 | + --no-internet-enable \ |
| 99 | + "$DMG" \ |
| 100 | + "$STAGE" |
| 101 | + rm -rf "$STAGE" |
| 102 | + echo "::endgroup::" |
| 103 | + done |
| 104 | + ls -la macos/release |
| 105 | +
|
| 106 | + - name: Create GitHub Release |
| 107 | + uses: softprops/action-gh-release@v2 |
| 108 | + with: |
| 109 | + files: macos/release/*.dmg |
| 110 | + fail_on_unmatched_files: true |
| 111 | + body: | |
| 112 | + ## Newbro Executor (macOS) |
| 113 | +
|
| 114 | + Unsigned menu-bar app. On first launch, right-click the app in |
| 115 | + `/Applications` and choose **Open** (or run |
| 116 | + `xattr -dr com.apple.quarantine "/Applications/Newbro Executor.app"`). |
| 117 | +
|
| 118 | + **Downloads** (pick the asset matching your Mac) |
| 119 | + - Apple Silicon (M-series): the `-arm64.dmg` asset below |
| 120 | + - Intel: the `-x86_64.dmg` asset below |
0 commit comments