Validate release workflow on Node 24 #9
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-packages | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true" | |
| jobs: | |
| desktop: | |
| name: build-${{ matrix.target }} | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: linux-x64 | |
| runner: ubuntu-24.04 | |
| skip_binary: "false" | |
| - target: linux-arm64 | |
| runner: ubuntu-24.04-arm | |
| skip_binary: "false" | |
| - target: windows-x64 | |
| runner: windows-latest | |
| skip_binary: "false" | |
| - target: windows-arm64 | |
| runner: windows-latest | |
| skip_binary: "true" | |
| - target: macos-x64 | |
| runner: macos-latest | |
| skip_binary: "true" | |
| - target: macos-arm64 | |
| runner: macos-14 | |
| skip_binary: "false" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install build dependencies | |
| run: python -m pip install --upgrade pip && python -m pip install -r requirements-build.txt | |
| - name: Test | |
| env: | |
| PYTHONPATH: src | |
| run: python -m pytest | |
| - name: Build artifacts | |
| shell: bash | |
| run: | | |
| if [ "${{ matrix.skip_binary }}" = "true" ]; then | |
| python scripts/build_artifacts.py --target "${{ matrix.target }}" --skip-binary | |
| else | |
| python scripts/build_artifacts.py --target "${{ matrix.target }}" | |
| fi | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: panclaw-${{ matrix.target }} | |
| path: dist/* | |
| mobile-contracts: | |
| name: mobile-contracts | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Verify mobile contracts | |
| run: | | |
| test -f mobile/android/README.md | |
| test -f mobile/ios/README.md | |
| test -f packaging/targets.json | |
| python -m json.tool packaging/targets.json >/dev/null | |
| python scripts/check_release_matrix.py | |
| - name: Upload mobile target contracts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: panclaw-mobile-contracts | |
| path: | | |
| mobile/android/README.md | |
| mobile/ios/README.md | |
| packaging/targets.json | |
| android: | |
| name: build-android-arm64 | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Read package version | |
| id: version | |
| shell: bash | |
| run: | | |
| version="$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')" | |
| echo "value=$version" >> "$GITHUB_OUTPUT" | |
| - name: Set up Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: "17" | |
| - name: Set up Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: Install Android SDK packages | |
| run: | | |
| yes | sdkmanager --licenses >/dev/null | |
| sdkmanager "platforms;android-35" "build-tools;35.0.0" | |
| - name: Set up Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| with: | |
| gradle-version: "8.11.1" | |
| - name: Build Android APK and AAB | |
| run: gradle -p mobile/android :app:assembleDebug :app:bundleDebug | |
| - name: Collect Android artifacts | |
| run: | | |
| mkdir -p dist | |
| cp mobile/android/app/build/outputs/apk/debug/app-debug.apk dist/panclaw-${{ steps.version.outputs.value }}-android-arm64-debug.apk | |
| cp mobile/android/app/build/outputs/bundle/debug/app-debug.aab dist/panclaw-${{ steps.version.outputs.value }}-android-arm64-debug.aab | |
| - name: Upload Android artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: panclaw-android-arm64 | |
| path: dist/* | |
| ios-unsigned: | |
| name: build-ios-arm64-unsigned | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Read package version | |
| id: version | |
| shell: bash | |
| run: | | |
| version="$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')" | |
| echo "value=$version" >> "$GITHUB_OUTPUT" | |
| - name: Build unsigned iOS shell artifacts | |
| run: python scripts/build_ios_unsigned.py --version "${{ steps.version.outputs.value }}" | |
| - name: Upload iOS artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: panclaw-ios-arm64 | |
| path: dist/* | |
| release: | |
| name: publish-github-release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| needs: [desktop, mobile-contracts, android, ios-unsigned] | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: release-artifacts | |
| - name: Create release and upload artifacts | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| tag="${GITHUB_REF_NAME}" | |
| version="${tag#v}" | |
| gh release create "$tag" --title "PanClaw $tag" --notes "Automated PanClaw package release." || true | |
| mkdir -p release-upload | |
| while IFS= read -r -d '' file; do | |
| parent="$(basename "$(dirname "$file")")" | |
| base="$(basename "$file")" | |
| case "$base" in | |
| "SHA256SUMS"|"panclaw-${version}.pyz"|"panclaw-${version}-py3-none-any.whl"|"panclaw-${version}.tar.gz") | |
| if [ "$parent" != "panclaw-linux-x64" ]; then | |
| continue | |
| fi | |
| ;; | |
| esac | |
| dest="release-upload/$base" | |
| if [ -e "$dest" ]; then | |
| dest="release-upload/${parent}-${base}" | |
| fi | |
| cp "$file" "$dest" | |
| done < <(find release-artifacts -mindepth 2 -maxdepth 2 -type f -print0) | |
| gh release upload "$tag" release-upload/* --clobber |