Check Upstream 7zz #102
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
| # SPDX-License-Identifier: MIT | |
| # SPDX-FileCopyrightText: 2025 py7zz contributors | |
| name: Check Upstream 7zz | |
| on: | |
| schedule: | |
| - cron: '30 0 * * *' # Run daily at 00:30 UTC (avoiding midnight congestion) | |
| workflow_dispatch: # Allow manual trigger | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| check-and-update: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Fetch all history for git describe | |
| - name: Check for updates | |
| id: check | |
| run: | | |
| chmod +x scripts/get_7zz.sh | |
| # Get latest version from online (with error handling) | |
| echo "Detecting latest 7zz version from upstream..." | |
| if ! LATEST_ONLINE=$(./scripts/get_7zz.sh --detect-latest); then | |
| echo "::error::Failed to detect latest 7zz version from upstream" | |
| echo "Output: $LATEST_ONLINE" | |
| exit 1 | |
| fi | |
| # Validate version format (should be like "25.01") | |
| if ! [[ "$LATEST_ONLINE" =~ ^[0-9]+\.[0-9]+$ ]]; then | |
| echo "::error::Invalid version format detected: '$LATEST_ONLINE'" | |
| exit 1 | |
| fi | |
| # Get current bundled version (with error handling) | |
| echo "Reading current bundled version..." | |
| if ! CURRENT_BUNDLED=$(./scripts/get_7zz.sh --get-current 2>&1); then | |
| echo "::error::Failed to read current bundled version" | |
| echo "Output: $CURRENT_BUNDLED" | |
| exit 1 | |
| fi | |
| echo "Latest online 7zz: $LATEST_ONLINE" | |
| echo "Current bundled 7zz: $CURRENT_BUNDLED" | |
| # Compare versions | |
| if dpkg --compare-versions "$LATEST_ONLINE" gt "$CURRENT_BUNDLED"; then | |
| echo "✨ Update found: $CURRENT_BUNDLED -> $LATEST_ONLINE" | |
| echo "update_needed=true" >> $GITHUB_OUTPUT | |
| echo "new_version=$LATEST_ONLINE" >> $GITHUB_OUTPUT | |
| else | |
| echo "✅ Up to date" | |
| echo "update_needed=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Prepare 7zz version bump | |
| if: steps.check.outputs.update_needed == 'true' | |
| run: | | |
| set -euo pipefail | |
| NEW_VERSION="${{ steps.check.outputs.new_version }}" | |
| CURRENT_VERSION=$(cat py7zz/7zz_version.txt | tr -d '[:space:]') | |
| echo "$NEW_VERSION" > py7zz/7zz_version.txt | |
| # Verify the new version can be downloaded (no artifacts committed; bin is gitignored) | |
| if ! ./scripts/get_7zz.sh --version "$NEW_VERSION"; then | |
| echo "::error::Failed to verify 7zz $NEW_VERSION download" | |
| exit 1 | |
| fi | |
| echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV | |
| - name: Create PR for 7zz Update | |
| if: steps.check.outputs.update_needed == 'true' | |
| uses: peter-evans/create-pull-request@v6 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: chore/update-7zz | |
| delete-branch: true | |
| base: main | |
| title: "chore: bump bundled 7zz to ${{ steps.check.outputs.new_version }}" | |
| commit-message: "chore: bump bundled 7zz to ${{ steps.check.outputs.new_version }}" | |
| labels: dependencies, automated, chore | |
| add-paths: py7zz/7zz_version.txt | |
| body: | | |
| ## Summary | |
| Detected a new 7-Zip release: **${{ steps.check.outputs.new_version }}**. | |
| This PR updates the bundled 7zz version. Release and tagging remain manual so branch protection stays intact. | |
| ## Changes | |
| - Update `py7zz/7zz_version.txt`: ${{ env.CURRENT_VERSION }} → ${{ steps.check.outputs.new_version }} | |
| ## Changelog Category | |
| - chore (dependency maintenance) | |
| ## Next Steps | |
| - Review and merge this PR when ready | |
| - Owner can run release workflow after merging to publish a new py7zz version | |
| Generated by [Check Upstream 7zz workflow](https://github.com/${{ github.repository }}/actions/workflows/check-upstream.yml) |