-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (94 loc) · 4.46 KB
/
check-base-update.yml
File metadata and controls
111 lines (94 loc) · 4.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
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>