Repository navigation
Build Release Binaries #38
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 Release Binaries | |
| on: | |
| release: | |
| types: [created] | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Release tag (e.g., v0.0.1)' | |
| required: true | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: macos-15 | |
| platform: darwin-arm64 | |
| - os: macos-15-large | |
| platform: darwin-x64 | |
| - os: ubuntu-22.04 | |
| platform: linux-x64 | |
| - os: ubuntu-22.04-arm | |
| platform: linux-arm64 | |
| - os: windows-latest | |
| platform: windows-x64 | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| - name: Install dependencies | |
| run: uv sync --extra cli && uv pip install pyinstaller>=6.0.0 | |
| - name: Get version | |
| id: version | |
| shell: bash | |
| run: | | |
| VERSION=$(grep '^version' pyproject.toml | sed 's/version = "\(.*\)"/\1/') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Build binary | |
| run: uv run python scripts/build.py --skip-deps | |
| - name: List build output | |
| shell: bash | |
| run: | | |
| echo "Build output:" | |
| ls -la dist/ | |
| echo "" | |
| echo "Archive contents:" | |
| if [ -f "dist/parallel-cli-${{ matrix.platform }}.zip" ]; then | |
| unzip -l "dist/parallel-cli-${{ matrix.platform }}.zip" | head -20 || true | |
| fi | |
| - name: Verify checksum file exists | |
| shell: bash | |
| run: | | |
| if [ ! -f "dist/parallel-cli-${{ matrix.platform }}.zip.sha256" ]; then | |
| echo "Error: Checksum file not found" | |
| exit 1 | |
| fi | |
| echo "Checksum: $(cat dist/parallel-cli-${{ matrix.platform }}.zip.sha256)" | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: binary-${{ matrix.platform }} | |
| path: | | |
| dist/parallel-cli-${{ matrix.platform }}.zip | |
| dist/parallel-cli-${{ matrix.platform }}.zip.sha256 | |
| retention-days: 1 | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| pattern: binary-* | |
| merge-multiple: true | |
| - name: Copy install script to artifacts | |
| run: cp install-cli.sh artifacts/install.sh | |
| - name: List artifacts | |
| run: | | |
| echo "Downloaded artifacts:" | |
| ls -la artifacts/ | |
| - name: Upload to Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: artifacts/* | |
| tag_name: ${{ github.event.release.tag_name || github.event.inputs.tag }} | |
| publish-npm: | |
| needs: release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Get version from tag | |
| id: version | |
| env: | |
| TAG: ${{ github.event.release.tag_name || github.event.inputs.tag }} | |
| run: | | |
| VERSION="${TAG#v}" | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Update package.json version | |
| working-directory: npm | |
| env: | |
| VERSION: ${{ steps.version.outputs.version }} | |
| run: npm version "$VERSION" --no-git-tag-version --allow-same-version | |
| - name: Publish to npm | |
| working-directory: npm | |
| run: npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| publish-homebrew: | |
| needs: release | |
| runs-on: ubuntu-latest | |
| # Skip for pre-release versions (RCs) | |
| if: ${{ !contains(github.event.release.tag_name || github.event.inputs.tag, 'rc') }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Get version from tag | |
| id: version | |
| env: | |
| TAG: ${{ github.event.release.tag_name || github.event.inputs.tag }} | |
| run: | | |
| VERSION="${TAG#v}" | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Download checksum files from release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| TAG: ${{ github.event.release.tag_name || github.event.inputs.tag }} | |
| run: | | |
| mkdir -p checksums | |
| for platform in darwin-arm64 darwin-x64; do | |
| gh release download "$TAG" \ | |
| --pattern "parallel-cli-${platform}.zip.sha256" \ | |
| --dir checksums || echo "Warning: No checksum for ${platform}" | |
| done | |
| echo "Downloaded checksums:" | |
| ls -la checksums/ | |
| - name: Generate Homebrew cask | |
| env: | |
| VERSION: ${{ steps.version.outputs.version }} | |
| run: | | |
| python scripts/update-homebrew-formula.py \ | |
| --version "$VERSION" \ | |
| --checksums-dir checksums \ | |
| --output cask/parallel-cli.rb | |
| echo "Generated cask:" | |
| cat cask/parallel-cli.rb | |
| - name: Push cask to Homebrew tap | |
| env: | |
| TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} | |
| VERSION: ${{ steps.version.outputs.version }} | |
| run: | | |
| git clone https://x-access-token:${TAP_TOKEN}@github.com/parallel-web/homebrew-tap.git tap-repo | |
| mkdir -p tap-repo/Casks | |
| cp cask/parallel-cli.rb tap-repo/Casks/parallel-cli.rb | |
| cd tap-repo | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add Casks/parallel-cli.rb | |
| if git diff --cached --quiet; then | |
| echo "No changes to cask" | |
| else | |
| git commit -m "Update parallel-cli to ${VERSION}" | |
| git push origin main | |
| echo "Cask updated successfully" | |
| fi |