[9] update actions to only build docker on code changes

pull/2045/head
meisnate12 6 months ago
parent 9c04fe6c76
commit 8b668f0c81

@ -6,15 +6,38 @@ on:
jobs:
docker:
verify-changes:
runs-on: ubuntu-latest
strategy:
matrix:
node:
- tag: develop
file: Dockerfile
- tag: lxml-develop
file: Dockerfile.lxml
outputs:
build: ${{ steps.list-changes.outputs.build }}
steps:
- name: Check Out Repo
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: develop
- name: Get changes
id: get-changes
run: echo "files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | xargs)" >> $GITHUB_OUTPUT
- name: List changed files
id: list-changes
run: |
for file in ${{ steps.get-changes.outputs.files }}; do
if [[ $file =~ ^(defaults|fonts|modules|kometa.py|requirements.txt|.dockerignore|Dockerfile).*$ ]] ; then
echo "$file will trigger docker build"
echo "build=true" >> $GITHUB_OUTPUT
else
echo "$file will not trigger docker build"
fi
done
docker-build:
runs-on: ubuntu-latest
needs: [ verify-changes ]
if: needs.verify-changes.outputs.build == 'true'
steps:
- name: Check Out Repo
@ -42,12 +65,12 @@ jobs:
uses: docker/build-push-action@v5
with:
context: ./
file: ./${{ matrix.node.file }}
file: ./Dockerfile
build-args: |
"BRANCH_NAME=develop"
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: kometateam/kometa:${{ matrix.node.tag }}
tags: kometateam/kometa:develop
cache-from: type=gha
cache-to: type=gha,mode=max
@ -56,7 +79,7 @@ jobs:
if: success()
with:
webhook_id_token: ${{ secrets.BUILD_WEBHOOK }}
title: "${{ vars.REPO_NAME }} ${{ matrix.node.tag }}: **Build Successful**"
title: "${{ vars.REPO_NAME }} develop: **Build Successful**"
url: https://github.com/Kometa-Team/${{ vars.REPO_NAME }}/actions/runs/${{ github.run_id }}
color: 844716
username: Kobota
@ -70,7 +93,7 @@ jobs:
with:
webhook_id_token: ${{ secrets.BUILD_WEBHOOK }}
message: <@&1079153184007790652>
title: "${{ vars.REPO_NAME }} ${{ matrix.node.tag }}: **Build Failed**"
title: "${{ vars.REPO_NAME }} develop: **Build Failed**"
url: https://github.com/Kometa-Team/${{ vars.REPO_NAME }}/actions/runs/${{ github.run_id }}
color: 14879811
username: Kobota
@ -80,8 +103,8 @@ jobs:
commit-notification:
runs-on: ubuntu-latest
if: ${{ success() }}
needs: [docker]
needs: [ docker-build, verify-changes ]
if: ${{ success() && needs.verify-changes.outputs.build == 'true' }}
steps:
- name: Send Discord Commit Notification

@ -6,15 +6,8 @@ on:
jobs:
docker:
docker-build:
runs-on: ubuntu-latest
strategy:
matrix:
node:
- tag: latest
file: Dockerfile
- tag: lxml-latest
file: Dockerfile.lxml
steps:
- name: Check Out Repo
@ -40,10 +33,10 @@ jobs:
uses: docker/build-push-action@v5
with:
context: ./
file: ./${{ matrix.node.file }}
file: ./Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: kometateam/kometa:${{ matrix.node.tag }}
tags: kometateam/kometa:latest
cache-from: type=gha
cache-to: type=gha,mode=max
@ -52,7 +45,7 @@ jobs:
if: success()
with:
webhook_id_token: ${{ secrets.BUILD_WEBHOOK }}
title: "${{ vars.REPO_NAME }} ${{ matrix.node.tag }}: **Build Successful**"
title: "${{ vars.REPO_NAME }} latest: **Build Successful**"
url: https://github.com/Kometa-Team/${{ vars.REPO_NAME }}/actions/runs/${{ github.run_id }}
color: 844716
username: Kobota
@ -66,7 +59,7 @@ jobs:
with:
webhook_id_token: ${{ secrets.BUILD_WEBHOOK }}
message: <@&1079153184007790652>
title: "${{ vars.REPO_NAME }} ${{ matrix.node.tag }}: **Build Failed**"
title: "${{ vars.REPO_NAME }} latest: **Build Failed**"
url: https://github.com/Kometa-Team/${{ vars.REPO_NAME }}/actions/runs/${{ github.run_id }}
color: 14879811
username: Kobota

@ -16,6 +16,7 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: nightly
- name: Get changes
id: get-changes
@ -25,7 +26,7 @@ jobs:
id: list-changes
run: |
for file in ${{ steps.get-changes.outputs.files }}; do
if [[ $file == defaults/* ]] || [[ $file == fonts/* ]] || [[ $file == modules/* ]] || [[ $file == kometa.py ]] || [[ $file == requirements.txt ]] || [[ $file == .dockerignore ]] || [[ $file == Dockerfile ]] || [[ $file == Dockerfile.lxml ]] ; then
if [[ $file =~ ^(defaults|fonts|modules|kometa.py|requirements.txt|.dockerignore|Dockerfile).*$ ]] ; then
echo "$file will trigger docker build"
echo "build=true" >> $GITHUB_OUTPUT
else
@ -33,17 +34,10 @@ jobs:
fi
done
docker:
needs: [verify-changes]
docker-build:
runs-on: ubuntu-latest
needs: [ verify-changes ]
if: needs.verify-changes.outputs.build == 'true'
strategy:
matrix:
node:
- tag: nightly
file: Dockerfile
- tag: lxml-nightly
file: Dockerfile.lxml
steps:
- name: Check Out Repo
@ -71,12 +65,12 @@ jobs:
uses: docker/build-push-action@v5
with:
context: ./
file: ./${{ matrix.node.file }}
file: ./Dockerfile
build-args: |
"BRANCH_NAME=nightly"
platforms: linux/amd64,linux/arm64
push: true
tags: kometateam/kometa:${{ matrix.node.tag }}
tags: kometateam/kometa:nightly
cache-from: type=gha
cache-to: type=gha,mode=max
@ -85,7 +79,7 @@ jobs:
if: success()
with:
webhook_id_token: ${{ secrets.BUILD_WEBHOOK }}
title: "${{ vars.REPO_NAME }} ${{ matrix.node.tag }}: **Build Successful**"
title: "${{ vars.REPO_NAME }} nightly: **Build Successful**"
url: https://github.com/Kometa-Team/${{ vars.REPO_NAME }}/actions/runs/${{ github.run_id }}
color: 844716
username: Kobota
@ -99,7 +93,7 @@ jobs:
with:
webhook_id_token: ${{ secrets.BUILD_WEBHOOK }}
message: <@&1079153184007790652>
title: "${{ vars.REPO_NAME }} ${{ matrix.node.tag }}: **Build Failed**"
title: "${{ vars.REPO_NAME }} nightly: **Build Failed**"
url: https://github.com/Kometa-Team/${{ vars.REPO_NAME }}/actions/runs/${{ github.run_id }}
color: 14879811
username: Kobota
@ -109,8 +103,8 @@ jobs:
commit-notification:
runs-on: ubuntu-latest
needs: [ docker-build, verify-changes ]
if: ${{ success() && needs.verify-changes.outputs.build == 'true' }}
needs: [docker, verify-changes]
steps:
- name: Send Discord Commit Notification

@ -7,7 +7,7 @@ on:
jobs:
docker:
docker-build:
if: ${{ startsWith(github.ref, 'refs/tags/v1') || startsWith(github.ref, 'refs/tags/v2') }}
runs-on: ubuntu-latest
steps:
@ -36,18 +36,6 @@ jobs:
id: get_version
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
- name: Build and Push LXML
id: docker_build_lxml
uses: docker/build-push-action@v5
with:
context: ./
file: ./Dockerfile.lxml
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: kometateam/kometa:lxml-${{ steps.get_version.outputs.VERSION }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and Push
id: docker_build
uses: docker/build-push-action@v5

@ -1,26 +0,0 @@
FROM python:3.11-slim-buster
ARG BRANCH_NAME=master
ENV BRANCH_NAME ${BRANCH_NAME}
ENV TINI_VERSION v0.19.0
ENV KOMETA_DOCKER True
ENV KOMETA_LXML True
COPY requirements.txt requirements.txt
RUN sed -i -E "s/(lxml==).+/\15.1.1/" requirements.txt
RUN echo "**** install system packages ****" \
&& apt-get update \
&& apt-get upgrade -y --no-install-recommends \
&& apt-get install -y tzdata --no-install-recommends \
&& apt-get install -y gcc g++ libxml2-dev libxslt-dev libz-dev libjpeg62-turbo-dev zlib1g-dev wget curl \
&& wget -O /tini https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-"$(dpkg --print-architecture | awk -F- '{ print $NF }')" \
&& chmod +x /tini \
&& pip3 install --no-cache-dir --upgrade --requirement /requirements.txt \
&& apt-get --purge autoremove gcc g++ libxml2-dev libxslt-dev libz-dev -y \
&& apt-get clean \
&& apt-get update \
&& apt-get check \
&& apt-get -f install \
&& apt-get autoclean \
&& rm -rf /requirements.txt /tmp/* /var/tmp/* /var/lib/apt/lists/*
COPY . /
VOLUME /config
ENTRYPOINT ["/tini", "-s", "python3", "kometa.py", "--"]

@ -1 +1 @@
2.0.1-develop8
2.0.1-develop9

@ -54,7 +54,6 @@ templates:
- region: CA
tmdb_key: [1899, 37]
value: False
default:
region: "US"
limit: "500"

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Before

Width:  |  Height:  |  Size: 145 KiB

After

Width:  |  Height:  |  Size: 145 KiB

Before

Width:  |  Height:  |  Size: 145 KiB

After

Width:  |  Height:  |  Size: 145 KiB

Before

Width:  |  Height:  |  Size: 373 KiB

After

Width:  |  Height:  |  Size: 373 KiB

Before

Width:  |  Height:  |  Size: 374 KiB

After

Width:  |  Height:  |  Size: 374 KiB

@ -147,7 +147,9 @@ nav:
- Frequently Asked Questions: kometa/faqs.md
- Explanation Guides: &guides
- Overview: kometa/guides/overview.md
- Switching from PMM to Kometa: kometa/guides/rebrand.md
- Plex Ratings Explained: kometa/guides/ratings.md
- Kometa Sorting Guide: kometa/guides/order.md
- Scheduling Kometa Runs Guide: kometa/guides/scheduling.md
- Image Asset Directory Guide: kometa/guides/assets.md
- Formula 1 Metadata Guide: kometa/guides/formula.md

@ -1,6 +1,6 @@
arrapi==1.4.13
GitPython==3.1.43
lxml==5.2.1
lxml==5.2.2
num2words==0.5.13
pathvalidate==3.2.0
pillow==10.3.0

Loading…
Cancel
Save