Check Base Image Updates #35
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: Check Base Image Updates | |
| on: | |
| schedule: | |
| - cron: '0 2 * * *' # Daily at 2 AM UTC | |
| workflow_dispatch: | |
| jobs: | |
| check-update: | |
| name: Check for Sonarr Base Image Updates | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Check for base image updates | |
| id: check | |
| run: | | |
| echo "π Checking for Sonarr base image updates..." | |
| # Get latest Sonarr version from LinuxServer API | |
| echo "π‘ Fetching latest version from LinuxServer API..." | |
| LATEST_VERSION=$(curl -s "https://api.linuxserver.io/api/v1/images" | jq -r '.data.repositories.linuxserver[] | select(.name == "sonarr") | .version') | |
| if [ -z "$LATEST_VERSION" ]; then | |
| echo "β Failed to fetch latest version from API" | |
| exit 1 | |
| else | |
| echo "β Latest Sonarr version from API: ${LATEST_VERSION}" | |
| fi | |
| echo "latest_version=${LATEST_VERSION}" >> $GITHUB_OUTPUT | |
| # Get current version from VERSION file | |
| echo "π Reading current version from VERSION file..." | |
| if [ -f VERSION ]; then | |
| source VERSION | |
| CURRENT_VERSION="${SONARR_VERSION}" | |
| echo "β Current version in repository: ${CURRENT_VERSION}" | |
| else | |
| echo "β VERSION file not found" | |
| exit 1 | |
| fi | |
| echo "current_version=${CURRENT_VERSION}" >> $GITHUB_OUTPUT | |
| # Check if update is needed | |
| echo "" | |
| echo "π Version comparison:" | |
| echo " Current: ${CURRENT_VERSION}" | |
| echo " Latest: ${LATEST_VERSION}" | |
| if [ "${LATEST_VERSION}" != "${CURRENT_VERSION}" ]; then | |
| echo "β Update needed! New version available." | |
| echo "update_needed=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "βΉοΈ No update needed. Already on latest version." | |
| echo "update_needed=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Update VERSION file | |
| if: steps.check.outputs.update_needed == 'true' | |
| run: | | |
| echo "π Updating VERSION file with new version..." | |
| echo "SONARR_VERSION=${{ steps.check.outputs.latest_version }}" > VERSION | |
| echo "β VERSION file updated to: ${{ steps.check.outputs.latest_version }}" | |
| # Show the change | |
| echo "" | |
| echo "π VERSION file content:" | |
| cat VERSION | |
| - name: Create Pull Request | |
| if: steps.check.outputs.update_needed == 'true' | |
| uses: peter-evans/create-pull-request@v5 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| commit-message: "chore: update Sonarr base image to ${{ steps.check.outputs.latest_version }}" | |
| title: "Update Sonarr base image to ${{ steps.check.outputs.latest_version }}" | |
| body: | | |
| ## π Automated Base Image Update | |
| This PR updates the Sonarr base image to version **`${{ steps.check.outputs.latest_version }}`**. | |
| ### π Changes | |
| - Updated `VERSION` file from `${{ steps.check.outputs.current_version }}` to `${{ steps.check.outputs.latest_version }}` | |
| - This will trigger a new Docker image build with the updated Sonarr version | |
| ### π What happens next? | |
| 1. Review the VERSION file change | |
| 2. Merge this PR to trigger the build workflow | |
| 3. The build workflow will: | |
| - Read the new version from the VERSION file | |
| - Build a new Docker image with Sonarr `${{ steps.check.outputs.latest_version }}` | |
| - Push to `ghcr.io/${{ github.repository }}` with tags: | |
| - `latest` | |
| - `${{ steps.check.outputs.latest_version }}-<date>` | |
| ### π Version Information | |
| - **Previous Version**: `${{ steps.check.outputs.current_version }}` | |
| - **New Version**: `${{ steps.check.outputs.latest_version }}` | |
| - **Source**: LinuxServer.io API | |
| --- | |
| *π€ This PR was automatically created by the base image update checker workflow.* | |
| branch: update-sonarr-${{ steps.check.outputs.latest_version }} | |
| delete-branch: true | |
| author: GitHub Actions <noreply@github.com> | |
| committer: Peter Farkas <peter@semmiseg.info> |