-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (77 loc) · 2.65 KB
/
poll_releases.yml
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
name: Poll branch releases
on:
workflow_call:
inputs:
branch:
description: 'App branch'
type: string
default: 'master'
outputs:
latestTag:
description: 'Current release tag'
value: '${{ jobs.check-latest.outputs.tag }}'
updateRequired:
description: 'New version found'
value: ${{ jobs.check-latest.outputs.update }}
upstreamVersion:
description: 'Upstream version'
value: '${{ jobs.check-latest.outputs.version }}'
jobs:
check-latest:
name: Check latest version
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
fail-fast: true
matrix:
arch: ["amd64"]
include:
- arch: amd64
os: ubuntu-latest
outputs:
tag: 'v${{ steps.current.outputs.version }}'
update: ${{ steps.check_tag.outputs.exists == 'false' }}
version: '${{ steps.upstream.outputs.version }}'
steps:
- name: Get upstream version
id: upstream
run: |
TAG=$(curl -sL --request GET \
--url "https://api.github.com/repos/Jackett/Jackett/releases" \
--header "Accept: application/vnd.github+json" \
--header "Authorization: token ${{ github.token }}" \
| jq -r 'first(.[]) | .tag_name')
echo "version=${TAG//v}" >> $GITHUB_OUTPUT
- name: Get current release
id: current
run: |
TAG=$(curl -sL --request GET \
--url "${{ github.api_url }}/repos/${{ github.repository }}/releases" \
--header "Accept: application/vnd.github+json" \
--header "Authorization: token ${{ github.token }}" \
| jq -r 'first(.[]) | .tag_name')
echo "version=${TAG//v}" >> $GITHUB_OUTPUT
- name: Check if tag exists
uses: mukunku/[email protected]
id: check_tag
with:
tag: 'v${{ steps.upstream.outputs.version }}'
- uses: actions/checkout@v4
if: steps.check_tag.outputs.exists == 'false'
- name: Update Readme
uses: MathieuSoysal/[email protected]
if: steps.check_tag.outputs.exists == 'false'
with:
files: README.md
version: '${{ steps.upstream.outputs.version }}'
old-version: '${{ steps.current.outputs.version }}'
with-checkout: false
- name: Push changes
uses: EndBug/add-and-commit@v9
if: steps.check_tag.outputs.exists == 'false'
with:
committer_name: GitHub Actions
committer_email: [email protected]
message: 'docs: Bump image version to ${{ steps.upstream.outputs.version }}'
tag: 'v${{ steps.upstream.outputs.version }}'