From 8b668f0c8197a7f917eca83c6e0330c608d06f23 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Tue, 14 May 2024 10:17:04 -0400 Subject: [PATCH] [9] update actions to only build docker on code changes --- .github/workflows/develop.yml | 51 +++++++++++++----- .github/workflows/latest.yml | 17 ++---- .github/workflows/nightly.yml | 24 ++++----- .github/workflows/version.yml | 14 +---- Dockerfile.lxml | 26 --------- VERSION | 2 +- defaults/both/streaming.yml | 1 - docs/{pmm => kometa}/guides/images/sorts.jpg | Bin .../guides/images/sorts_example1.png | Bin .../guides/images/sorts_example2.png | Bin .../guides/images/sorts_example3.jpg | Bin .../guides/images/sorts_example4.jpg | Bin docs/{pmm => kometa}/guides/order.md | 0 mkdocs.yml | 2 + requirements.txt | 2 +- 15 files changed, 56 insertions(+), 83 deletions(-) delete mode 100644 Dockerfile.lxml rename docs/{pmm => kometa}/guides/images/sorts.jpg (100%) rename docs/{pmm => kometa}/guides/images/sorts_example1.png (100%) rename docs/{pmm => kometa}/guides/images/sorts_example2.png (100%) rename docs/{pmm => kometa}/guides/images/sorts_example3.jpg (100%) rename docs/{pmm => kometa}/guides/images/sorts_example4.jpg (100%) rename docs/{pmm => kometa}/guides/order.md (100%) diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index b6519dca..88567e4c 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -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 diff --git a/.github/workflows/latest.yml b/.github/workflows/latest.yml index 9eee12a7..d9850b62 100644 --- a/.github/workflows/latest.yml +++ b/.github/workflows/latest.yml @@ -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 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 4de94add..f2254a34 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -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 diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml index 57656b35..efb7cef7 100644 --- a/.github/workflows/version.yml +++ b/.github/workflows/version.yml @@ -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 diff --git a/Dockerfile.lxml b/Dockerfile.lxml deleted file mode 100644 index 2b90789a..00000000 --- a/Dockerfile.lxml +++ /dev/null @@ -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", "--"] diff --git a/VERSION b/VERSION index c5f23d5b..0c791ca5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.1-develop8 +2.0.1-develop9 diff --git a/defaults/both/streaming.yml b/defaults/both/streaming.yml index aa2e69fe..4f1df057 100644 --- a/defaults/both/streaming.yml +++ b/defaults/both/streaming.yml @@ -54,7 +54,6 @@ templates: - region: CA tmdb_key: [1899, 37] value: False - default: region: "US" limit: "500" diff --git a/docs/pmm/guides/images/sorts.jpg b/docs/kometa/guides/images/sorts.jpg similarity index 100% rename from docs/pmm/guides/images/sorts.jpg rename to docs/kometa/guides/images/sorts.jpg diff --git a/docs/pmm/guides/images/sorts_example1.png b/docs/kometa/guides/images/sorts_example1.png similarity index 100% rename from docs/pmm/guides/images/sorts_example1.png rename to docs/kometa/guides/images/sorts_example1.png diff --git a/docs/pmm/guides/images/sorts_example2.png b/docs/kometa/guides/images/sorts_example2.png similarity index 100% rename from docs/pmm/guides/images/sorts_example2.png rename to docs/kometa/guides/images/sorts_example2.png diff --git a/docs/pmm/guides/images/sorts_example3.jpg b/docs/kometa/guides/images/sorts_example3.jpg similarity index 100% rename from docs/pmm/guides/images/sorts_example3.jpg rename to docs/kometa/guides/images/sorts_example3.jpg diff --git a/docs/pmm/guides/images/sorts_example4.jpg b/docs/kometa/guides/images/sorts_example4.jpg similarity index 100% rename from docs/pmm/guides/images/sorts_example4.jpg rename to docs/kometa/guides/images/sorts_example4.jpg diff --git a/docs/pmm/guides/order.md b/docs/kometa/guides/order.md similarity index 100% rename from docs/pmm/guides/order.md rename to docs/kometa/guides/order.md diff --git a/mkdocs.yml b/mkdocs.yml index 209856f5..a53764ba 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -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 diff --git a/requirements.txt b/requirements.txt index ffd44183..f9b178a3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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