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

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

@ -6,15 +6,38 @@ on:
jobs: jobs:
docker: verify-changes:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: outputs:
matrix: build: ${{ steps.list-changes.outputs.build }}
node: steps:
- tag: develop
file: Dockerfile - name: Check Out Repo
- tag: lxml-develop uses: actions/checkout@v4
file: Dockerfile.lxml 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: steps:
- name: Check Out Repo - name: Check Out Repo
@ -42,12 +65,12 @@ jobs:
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
context: ./ context: ./
file: ./${{ matrix.node.file }} file: ./Dockerfile
build-args: | build-args: |
"BRANCH_NAME=develop" "BRANCH_NAME=develop"
platforms: linux/amd64,linux/arm64,linux/arm/v7 platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true push: true
tags: kometateam/kometa:${{ matrix.node.tag }} tags: kometateam/kometa:develop
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
@ -56,7 +79,7 @@ jobs:
if: success() if: success()
with: with:
webhook_id_token: ${{ secrets.BUILD_WEBHOOK }} 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 }} url: https://github.com/Kometa-Team/${{ vars.REPO_NAME }}/actions/runs/${{ github.run_id }}
color: 844716 color: 844716
username: Kobota username: Kobota
@ -70,7 +93,7 @@ jobs:
with: with:
webhook_id_token: ${{ secrets.BUILD_WEBHOOK }} webhook_id_token: ${{ secrets.BUILD_WEBHOOK }}
message: <@&1079153184007790652> 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 }} url: https://github.com/Kometa-Team/${{ vars.REPO_NAME }}/actions/runs/${{ github.run_id }}
color: 14879811 color: 14879811
username: Kobota username: Kobota
@ -80,8 +103,8 @@ jobs:
commit-notification: commit-notification:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ success() }} needs: [ docker-build, verify-changes ]
needs: [docker] if: ${{ success() && needs.verify-changes.outputs.build == 'true' }}
steps: steps:
- name: Send Discord Commit Notification - name: Send Discord Commit Notification

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

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

@ -7,7 +7,7 @@ on:
jobs: jobs:
docker: docker-build:
if: ${{ startsWith(github.ref, 'refs/tags/v1') || startsWith(github.ref, 'refs/tags/v2') }} if: ${{ startsWith(github.ref, 'refs/tags/v1') || startsWith(github.ref, 'refs/tags/v2') }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -36,18 +36,6 @@ jobs:
id: get_version id: get_version
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT 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 - name: Build and Push
id: docker_build id: docker_build
uses: docker/build-push-action@v5 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 - region: CA
tmdb_key: [1899, 37] tmdb_key: [1899, 37]
value: False value: False
default: default:
region: "US" region: "US"
limit: "500" 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 - Frequently Asked Questions: kometa/faqs.md
- Explanation Guides: &guides - Explanation Guides: &guides
- Overview: kometa/guides/overview.md - Overview: kometa/guides/overview.md
- Switching from PMM to Kometa: kometa/guides/rebrand.md
- Plex Ratings Explained: kometa/guides/ratings.md - Plex Ratings Explained: kometa/guides/ratings.md
- Kometa Sorting Guide: kometa/guides/order.md
- Scheduling Kometa Runs Guide: kometa/guides/scheduling.md - Scheduling Kometa Runs Guide: kometa/guides/scheduling.md
- Image Asset Directory Guide: kometa/guides/assets.md - Image Asset Directory Guide: kometa/guides/assets.md
- Formula 1 Metadata Guide: kometa/guides/formula.md - Formula 1 Metadata Guide: kometa/guides/formula.md

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

Loading…
Cancel
Save