chore: align package.json version and bump to 1.2.3 #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: Build and Release Binaries | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| env: | |
| EXECUTA_DIR: executas/redpen | |
| jobs: | |
| meta: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| tool_id: ${{ steps.meta.outputs.tool_id }} | |
| version: ${{ steps.meta.outputs.version }} | |
| tag: ${{ steps.meta.outputs.tag }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - id: meta | |
| run: | | |
| python3 - <<'PY' >> "$GITHUB_OUTPUT" | |
| import json | |
| from pathlib import Path | |
| p = Path("executas/redpen/executa.json") | |
| data = json.loads(p.read_text("utf-8")) | |
| tool_id = data["tool_id"] | |
| version = data.get("version") or "0.0.0" | |
| tag = f"v{version}" | |
| print(f"tool_id={tool_id}") | |
| print(f"version={version}") | |
| print(f"tag={tag}") | |
| PY | |
| build: | |
| needs: meta | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: darwin-arm64 | |
| os: macos-14 | |
| arch: arm64 | |
| - platform: darwin-x86_64 | |
| os: macos-14 | |
| arch: x64 | |
| - platform: linux-x86_64 | |
| os: ubuntu-latest | |
| arch: x64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| architecture: ${{ matrix.arch }} | |
| - uses: astral-sh/setup-uv@v5 | |
| - name: Build binary archive | |
| working-directory: ${{ env.EXECUTA_DIR }} | |
| env: | |
| TOOL_ID: ${{ needs.meta.outputs.tool_id }} | |
| PLATFORM: ${{ matrix.platform }} | |
| run: | | |
| chmod +x package_binary.sh | |
| if [ "${{ matrix.platform }}" = "darwin-x86_64" ]; then | |
| export ARCHFLAGS="-arch x86_64" | |
| export _PYTHON_HOST_PLATFORM="macosx-10.9-x86_64" | |
| arch -x86_64 ./package_binary.sh | |
| else | |
| ./package_binary.sh | |
| fi | |
| expected="dist-anna/$TOOL_ID-$PLATFORM.tar.gz" | |
| test -f "$expected" | |
| - name: Write sha256 file | |
| working-directory: ${{ env.EXECUTA_DIR }} | |
| env: | |
| TOOL_ID: ${{ needs.meta.outputs.tool_id }} | |
| PLATFORM: ${{ matrix.platform }} | |
| run: | | |
| archive="dist-anna/$TOOL_ID-$PLATFORM.tar.gz" | |
| if command -v shasum >/dev/null 2>&1; then | |
| shasum -a 256 "$archive" > "$archive.sha256" | |
| else | |
| sha256sum "$archive" > "$archive.sha256" | |
| fi | |
| cat "$archive.sha256" | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ needs.meta.outputs.tool_id }}-${{ matrix.platform }} | |
| path: | | |
| ${{ env.EXECUTA_DIR }}/dist-anna/${{ needs.meta.outputs.tool_id }}-${{ matrix.platform }}.tar.gz | |
| ${{ env.EXECUTA_DIR }}/dist-anna/${{ needs.meta.outputs.tool_id }}-${{ matrix.platform }}.tar.gz.sha256 | |
| release: | |
| needs: [meta, build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: release-assets | |
| merge-multiple: true | |
| - name: List release assets | |
| run: | | |
| find release-assets -type f -maxdepth 1 -print | sort | |
| - name: Create or update GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ needs.meta.outputs.tag }} | |
| name: Release ${{ needs.meta.outputs.tag }} | |
| make_latest: true | |
| fail_on_unmatched_files: true | |
| files: release-assets/* |