Skip to content

Commit

Permalink
sonarr version check
Browse files Browse the repository at this point in the history
  • Loading branch information
punoko committed Apr 17, 2024
1 parent bd05463 commit ea29ed2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
with:
images: ghcr.io/${{ github.repository_owner }}/${{ inputs.app }}
flavor: latest=true
tags: ${{ inputs.tags }}

- name: Build and push images
uses: docker/build-push-action@v5
Expand All @@ -45,6 +46,6 @@ jobs:
uses: actions/delete-package-versions@v4
with:
package-name: ${{ inputs.app }}
package-type: 'container'
package-type: "container"
min-versions-to-keep: 5
delete-only-untagged-versions: 'true'
delete-only-untagged-versions: "true"
33 changes: 27 additions & 6 deletions .github/workflows/sonarr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,38 @@ name: Sonarr
on:
push:
branches:
- main
- main
paths:
- sonarr/Dockerfile
- sonarr/Dockerfile
schedule:
- cron: "0 3 * * *"
workflow_dispatch:

jobs:
call-main-workflow:
uses: ./.github/workflows/main.yml
check-version:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
with:
app: sonarr
steps:
- name: Get release version
run: echo VERSION=$(curl -s https://services.sonarr.tv/v1/releases | jq -r '."v4-stable".version') >> $GITHUB_ENV

- name: Print release version
run: echo $VERSION

- name: Compare to repo version
run: |
echo CHECK=$(curl -s -H "Authorization: Bearer $(echo -n ${{ secrets.GITHUB_TOKEN }} | base64)" https://ghcr.io/v2/${{ github.repository_owner }}/sonarr/tags/list | jq -r '.tags[]' | grep $VERSION || true) >> $GITHUB_ENV
- name: Build image
# if: ${{ env.CHECK == '' || github.event_name == 'workflow_dispatch' }}
if: ${{ env.CHECK == '' }}
uses: ./.github/workflows/main.yml
with:
app: sonarr
tags: |
type=ref,event=branch
type=sha
type=raw,value=v4-stable
type=raw,value=${{ env.VERSION }}

0 comments on commit ea29ed2

Please sign in to comment.