chore(deps): update pnpm to v10.24.0 (#67) #162
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 | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| packages: write | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| FNOX_AGE_KEY: ${{ secrets.FNOX_AGE_KEY }} | |
| jobs: | |
| check-release: | |
| name: Check if release is needed | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should_release: ${{ steps.check.outputs.should_release }} | |
| new_version: ${{ steps.check.outputs.new_version }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install git-cliff | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: git-cliff | |
| - name: Check if release is needed | |
| id: check | |
| run: | | |
| # Get the latest tag or use v0.0.0 if no tags exist | |
| LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") | |
| echo "Latest tag: $LATEST_TAG" | |
| # Check if there are any releasable commits since the last tag | |
| if git-cliff --unreleased --strip all | grep -q '###'; then | |
| # Calculate the next version | |
| NEW_VERSION=$(git-cliff --bumped-version --strip all) | |
| echo "New version: $NEW_VERSION" | |
| echo "should_release=true" >> $GITHUB_OUTPUT | |
| echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT | |
| else | |
| echo "No releasable commits found" | |
| echo "should_release=false" >> $GITHUB_OUTPUT | |
| fi | |
| build: | |
| name: Build ${{ matrix.target }} | |
| needs: check-release | |
| if: needs.check-release.outputs.should_release == 'true' | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Linux x86_64 | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| archive: tar.gz tar.xz tar.zst | |
| - target: x86_64-unknown-linux-musl | |
| os: ubuntu-latest | |
| archive: tar.gz tar.xz tar.zst | |
| # Linux ARM64 | |
| - target: aarch64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| archive: tar.gz tar.xz tar.zst | |
| - target: aarch64-unknown-linux-musl | |
| os: ubuntu-latest | |
| archive: tar.gz tar.xz tar.zst | |
| # Linux ARMv7 | |
| - target: armv7-unknown-linux-gnueabihf | |
| os: ubuntu-latest | |
| archive: tar.gz tar.xz tar.zst | |
| - target: armv7-unknown-linux-musleabihf | |
| os: ubuntu-latest | |
| archive: tar.gz tar.xz tar.zst | |
| # macOS x86_64 | |
| - target: x86_64-apple-darwin | |
| os: macos-latest | |
| archive: tar.gz tar.xz tar.zst | |
| # macOS ARM64 | |
| - target: aarch64-apple-darwin | |
| os: macos-latest | |
| archive: tar.gz tar.xz tar.zst | |
| # Windows x86_64 | |
| - target: x86_64-pc-windows-msvc | |
| os: windows-latest | |
| archive: zip | |
| # Windows ARM64 | |
| - target: aarch64-pc-windows-msvc | |
| os: windows-latest | |
| archive: zip | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Update Cargo.toml version | |
| shell: bash | |
| run: | | |
| VERSION="${{ needs.check-release.outputs.new_version }}" | |
| # Remove 'v' prefix if present | |
| VERSION="${VERSION#v}" | |
| sed -i.bak "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml | |
| rm Cargo.toml.bak 2>/dev/null || true | |
| echo "Updated Cargo.toml to version $VERSION" | |
| grep "^version = " Cargo.toml | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install protoc 28.3 (matching .mise.toml version) | |
| shell: bash | |
| run: | | |
| PROTOC_VERSION=28.3 | |
| OS=$(uname -s | tr '[:upper:]' '[:lower:]') | |
| if [[ "$OS" == "darwin" ]]; then | |
| OS="osx" # protoc uses 'osx' not 'darwin' | |
| PROTOC_ARCH=$(uname -m) | |
| if [[ "$PROTOC_ARCH" == "arm64" ]]; then | |
| PROTOC_ARCH="aarch_64" | |
| fi | |
| PROTOC_ZIP="protoc-${PROTOC_VERSION}-${OS}-${PROTOC_ARCH}.zip" | |
| elif [[ "$OS" == "linux" ]]; then | |
| PROTOC_ARCH="x86_64" | |
| PROTOC_ZIP="protoc-${PROTOC_VERSION}-${OS}-${PROTOC_ARCH}.zip" | |
| else | |
| # Windows - no arch suffix, just win64 or win32 | |
| PROTOC_ZIP="protoc-${PROTOC_VERSION}-win64.zip" | |
| fi | |
| # Create target directory | |
| mkdir -p $HOME/.local | |
| # Download and extract | |
| curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/${PROTOC_ZIP} | |
| unzip -q ${PROTOC_ZIP} -d $HOME/.local | |
| # Add to PATH (convert to Windows format on Windows for PowerShell compatibility) | |
| if [[ "$OS" == "mingw"* ]] || [[ "$OS" == "msys"* ]] || [[ "$(uname -o 2>/dev/null)" == "Msys" ]]; then | |
| # Convert Unix path to Windows path for PowerShell | |
| WINDOWS_PATH=$(cygpath -w "$HOME/.local/bin") | |
| echo "$WINDOWS_PATH" >> $GITHUB_PATH | |
| else | |
| echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| fi | |
| # Cleanup | |
| rm ${PROTOC_ZIP} | |
| # Verify installation | |
| ls -la $HOME/.local/bin/protoc* | |
| - name: Install cross-compilation tools (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| cargo install cross --git https://github.com/cross-rs/cross | |
| - name: Build binary and libraries (Linux cross-compile) | |
| if: runner.os == 'Linux' | |
| run: | | |
| cross build --release --target ${{ matrix.target }} | |
| cross build --release --lib --target ${{ matrix.target }} | |
| - name: Build binary and libraries (macOS/Windows) | |
| if: runner.os != 'Linux' | |
| run: | | |
| cargo build --release --target ${{ matrix.target }} | |
| cargo build --release --lib --target ${{ matrix.target }} | |
| - name: Create archives | |
| shell: bash | |
| run: | | |
| VERSION="${{ needs.check-release.outputs.new_version }}" | |
| TARGET="${{ matrix.target }}" | |
| ARCHIVE_FORMATS="${{ matrix.archive }}" | |
| cd target/$TARGET/release | |
| # Determine binary and library names based on platform | |
| if [[ "$TARGET" == *"windows"* ]]; then | |
| BINARY="fabrik.exe" | |
| SHARED_LIB="fabrik.dll" | |
| STATIC_LIB="fabrik.lib" | |
| elif [[ "$TARGET" == *"darwin"* ]]; then | |
| BINARY="fabrik" | |
| SHARED_LIB="libfabrik.dylib" | |
| STATIC_LIB="libfabrik.a" | |
| else | |
| BINARY="fabrik" | |
| SHARED_LIB="libfabrik.so" | |
| STATIC_LIB="libfabrik.a" | |
| fi | |
| # Create a staging directory | |
| mkdir -p ../../../dist | |
| DIST_DIR="$(pwd)/../../../dist" | |
| # Create temporary directory for archive contents | |
| TEMP_DIR=$(mktemp -d) | |
| mkdir -p "$TEMP_DIR/bin" "$TEMP_DIR/lib" "$TEMP_DIR/include" | |
| # Copy files | |
| cp "$BINARY" "$TEMP_DIR/bin/" | |
| [[ -f "$SHARED_LIB" ]] && cp "$SHARED_LIB" "$TEMP_DIR/lib/" | |
| [[ -f "$STATIC_LIB" ]] && cp "$STATIC_LIB" "$TEMP_DIR/lib/" | |
| cp ../../../include/fabrik.h "$TEMP_DIR/include/" | |
| # Create README for the archive | |
| cat > "$TEMP_DIR/README.txt" << 'EOF' | |
| Fabrik - Multi-layer build cache infrastructure | |
| This archive contains: | |
| - bin/fabrik(.exe): CLI tool | |
| - lib/libfabrik.*: C library (shared and/or static) | |
| - include/fabrik.h: C header file | |
| For documentation, visit: https://github.com/tuist/fabrik | |
| C API Documentation: https://github.com/tuist/fabrik/blob/main/docs/c-api.md | |
| EOF | |
| # Create archives based on format | |
| cd "$TEMP_DIR" | |
| for FORMAT in $ARCHIVE_FORMATS; do | |
| ARCHIVE_NAME="fabrik-${VERSION}-${TARGET}" | |
| case $FORMAT in | |
| tar.gz) | |
| tar czf "${DIST_DIR}/${ARCHIVE_NAME}.tar.gz" * | |
| ;; | |
| tar.xz) | |
| tar cJf "${DIST_DIR}/${ARCHIVE_NAME}.tar.xz" * | |
| ;; | |
| tar.zst) | |
| tar --zstd -cf "${DIST_DIR}/${ARCHIVE_NAME}.tar.zst" * | |
| ;; | |
| zip) | |
| 7z a "${DIST_DIR}/${ARCHIVE_NAME}.zip" * | |
| ;; | |
| esac | |
| done | |
| # Cleanup | |
| rm -rf "$TEMP_DIR" | |
| - name: Generate checksums | |
| shell: bash | |
| run: | | |
| cd dist | |
| for file in fabrik-*; do | |
| if [[ "$RUNNER_OS" == "Windows" ]]; then | |
| certutil -hashfile "$file" SHA256 | grep -v "hash" | tr -d ' \r\n' > "${file}.sha256" | |
| else | |
| shasum -a 256 "$file" | cut -d ' ' -f 1 > "${file}.sha256" | |
| fi | |
| done | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: fabrik-${{ matrix.target }} | |
| path: dist/* | |
| retention-days: 1 | |
| docker: | |
| name: Build and Push Docker Images | |
| needs: check-release | |
| if: needs.check-release.outputs.should_release == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=semver,pattern={{version}},value=${{ needs.check-release.outputs.new_version }} | |
| type=semver,pattern={{major}}.{{minor}},value=${{ needs.check-release.outputs.new_version }} | |
| type=semver,pattern={{major}},value=${{ needs.check-release.outputs.new_version }} | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| platforms: linux/amd64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| build-args: | | |
| VERSION=${{ needs.check-release.outputs.new_version }} | |
| create-release: | |
| name: Create GitHub Release | |
| needs: [check-release, build, docker] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install git-cliff | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: git-cliff | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v6 | |
| with: | |
| path: artifacts | |
| pattern: fabrik-* | |
| merge-multiple: true | |
| - name: Update Cargo.toml version | |
| run: | | |
| VERSION="${{ needs.check-release.outputs.new_version }}" | |
| # Remove 'v' prefix if present | |
| VERSION="${VERSION#v}" | |
| sed -i.bak "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml | |
| rm Cargo.toml.bak 2>/dev/null || true | |
| echo "Updated Cargo.toml to version $VERSION" | |
| grep "^version = " Cargo.toml | |
| - name: Generate changelog | |
| run: | | |
| VERSION="${{ needs.check-release.outputs.new_version }}" | |
| git-cliff --tag "$VERSION" -o CHANGELOG.md | |
| # Generate release notes (latest version only, without version header) | |
| git-cliff --tag "$VERSION" --unreleased --strip all -o RELEASE_NOTES.md | |
| # Remove the version header line (e.g., "## [0.1.0] - 2025-10-24") | |
| # Keep only the grouped changes | |
| tail -n +2 RELEASE_NOTES.md > RELEASE_NOTES.tmp && mv RELEASE_NOTES.tmp RELEASE_NOTES.md | |
| # Add Docker image information to release notes | |
| echo "" >> RELEASE_NOTES.md | |
| echo "## 🐳 Docker Image" >> RELEASE_NOTES.md | |
| echo "" >> RELEASE_NOTES.md | |
| echo "Pull the Docker image from GitHub Container Registry:" >> RELEASE_NOTES.md | |
| echo "" >> RELEASE_NOTES.md | |
| echo '```bash' >> RELEASE_NOTES.md | |
| echo "docker pull ghcr.io/tuist/fabrik:${VERSION}" >> RELEASE_NOTES.md | |
| echo "docker pull ghcr.io/tuist/fabrik:latest" >> RELEASE_NOTES.md | |
| echo '```' >> RELEASE_NOTES.md | |
| echo "" >> RELEASE_NOTES.md | |
| echo "**Registry**: [ghcr.io/tuist/fabrik](https://github.com/tuist/fabrik/pkgs/container/fabrik)" >> RELEASE_NOTES.md | |
| - name: Create SHA256SUMS file | |
| run: | | |
| cd artifacts | |
| cat *.sha256 > SHA256SUMS | |
| # Also create individual checksums in a readable format | |
| for file in fabrik-*; do | |
| if [[ ! "$file" == *.sha256 ]]; then | |
| sha256sum "$file" >> SHA256SUMS.txt | |
| fi | |
| done | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ needs.check-release.outputs.new_version }} | |
| name: ${{ needs.check-release.outputs.new_version }} | |
| body_path: RELEASE_NOTES.md | |
| draft: false | |
| prerelease: false | |
| files: | | |
| artifacts/fabrik-* | |
| artifacts/SHA256SUMS | |
| artifacts/SHA256SUMS.txt | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Commit version bumps | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add Cargo.toml CHANGELOG.md | |
| git commit -m "chore(release): bump version to ${{ needs.check-release.outputs.new_version }}" | |
| git push | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |