-
Notifications
You must be signed in to change notification settings - Fork 9
115 lines (103 loc) 路 3.77 KB
/
Copy pathauto-update.yaml
File metadata and controls
115 lines (103 loc) 路 3.77 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
112
113
114
115
name: 'Update App Version'
on:
schedule:
- cron: '0 2 * * *'
workflow_dispatch:
jobs:
get-latest-app-version:
name: 'Check App Updates'
runs-on: 'ubuntu-latest'
permissions:
contents: 'write'
pull-requests: 'write'
strategy:
fail-fast: false
matrix:
include:
- name: 'bazarr'
repo: 'linuxserver/bazarr'
- name: 'cleanuparr'
repo: 'cleanuparr/cleanuparr'
hub: 'ghcr'
strip_prefix: 'v'
- name: 'flaresolverr'
repo: 'flaresolverr/flaresolverr'
- name: 'homarr'
repo: 'homarr-labs/homarr'
hub: 'ghcr'
- name: 'profilarr'
repo: 'santiagosayshey/profilarr'
- name: 'jellyfin'
repo: 'jellyfin/jellyfin'
strip_prefix: 'v'
- name: 'lidarr'
repo: 'linuxserver/lidarr'
- name: 'prowlarr'
repo: 'linuxserver/prowlarr'
- name: 'radarr'
repo: 'linuxserver/radarr'
- name: 'readarr'
repo: 'linuxserver/readarr'
allow_prerelease: true
- name: 'sabnzbd'
repo: 'linuxserver/sabnzbd'
- name: 'sonarr'
repo: 'linuxserver/sonarr'
- name: 'tinymediamanager'
repo: 'tinymediamanager/tinymediamanager'
- name: 'transmission'
repo: 'linuxserver/transmission'
steps:
- uses: 'actions/checkout@v4'
with:
fetch-depth: 0
token: ${{ secrets.AUTO_UPDATE_PAT }}
- name: 'Update AppVersion and ChartVersion'
run: |
# Set global script settings
export ALLOW_PRERELEASE='${{ matrix.allow_prerelease }}'
export STRIP_VERSION_PREFIX='${{ matrix.strip_prefix }}'
# The script writes VERSION_TYPE (major|minor|patch) to $GITHUB_ENV.
./scripts/update_appversion.sh \
'${{ matrix.name }}' \
'${{ matrix.repo }}' \
'${{ matrix.hub }}'
- name: 'Check for changes'
id: changes
run: |
if [[ -n "$(git status --porcelain)" ]]; then
echo "CHANGES_FOUND=true" >> $GITHUB_ENV
git diff
else
echo "CHANGES_FOUND=false" >> $GITHUB_ENV
fi
- name: 'Set up Git'
if: env.CHANGES_FOUND == 'true'
run: |
git config --global user.name "github-actions"
git config --global user.email "github-actions@users.noreply.github.com"
app_version=$(awk '/^appVersion:/ {print $2}' "./charts/${{ matrix.name }}/Chart.yaml")
BRANCH_NAME="update-${{ matrix.name }}-${app_version}"
COMMIT_MSG="New app version found for ${{ matrix.name }}"
echo "BRANCH_NAME=$BRANCH_NAME" >> "$GITHUB_ENV"
echo "COMMIT_MSG=$BRANCH_NAME" >> "$GITHUB_ENV"
if [[ "$VERSION_TYPE" != "major" ]]; then
echo "AUTOMERGE=true" >> "$GITHUB_ENV"
fi
- name: 'Create Pull Request'
id: create-pr
if: env.CHANGES_FOUND == 'true'
uses: 'peter-evans/create-pull-request@v7'
with:
token: ${{ secrets.AUTO_UPDATE_PAT }}
commit-message: ${{ env.COMMIT_MSG }}
title: "猸愶笍 New App Version: Update ${{ matrix.name }}"
body: 'Automated Workflow. New App Version found for Chart'
branch: ${{ env.BRANCH_NAME }}
base: ${{ github.event.repository.default_branch }}
- name: 'Enable auto-merge for non-major bumps'
if: env.AUTOMERGE == 'true' && steps.create-pr.outputs.pull-request-number
env:
GH_TOKEN: ${{ secrets.AUTO_UPDATE_PAT }}
PR_NUMBER: ${{ steps.create-pr.outputs.pull-request-number }}
run: gh pr merge --auto --squash "$PR_NUMBER"