From ed7ad9e3976f591723ad6e5bc2bfd6ed44f5c456 Mon Sep 17 00:00:00 2001 From: Ashley Date: Fri, 6 Oct 2023 09:20:58 +0100 Subject: [PATCH 1/2] Refactor Dockerfile and GitHub workflows - Update Dockerfile and GitHub workflows to use the new `latest` file instead of `.github/latest` or `package.json` for versioning. - The `latest` file will store the current version of the project. - The Dockerfile now copies the `latest` file into the container's `/data` directory. - The GitHub workflows now retrieve the previous and current versions from the `latest` file. - Removed unused `package.json` file. Co-authored-by: Ashley Bailey --- .dockerignore | 1 - .github/workflows/beta-ci.yml | 4 ++-- .github/workflows/beta-release.yml | 10 +++++----- Dockerfile | 8 ++++---- backend/app/utils/software_lifecycle.py | 4 ++-- .github/latest => latest | 0 package.json | 3 --- 7 files changed, 13 insertions(+), 17 deletions(-) rename .github/latest => latest (100%) delete mode 100644 package.json diff --git a/.dockerignore b/.dockerignore index 27899c6ba..5f2af4dac 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,7 +3,6 @@ venv/ .DS_Store .gitignore .git -.github .idea .buildHelper.txt node_modules diff --git a/.github/workflows/beta-ci.yml b/.github/workflows/beta-ci.yml index 6480cb18f..1e8906cdd 100644 --- a/.github/workflows/beta-ci.yml +++ b/.github/workflows/beta-ci.yml @@ -22,9 +22,9 @@ jobs: uses: actions/checkout@v2 # Get the Release Version from .github/latest - - name: Get the Release Version from .github/latest + - name: Get the Release Version from latest id: get_version - run: echo "::set-output name=version::$(cat .github/latest)" + run: echo "::set-output name=version::$(cat latest)" # Set up Docker Buildx - name: Set up Docker Buildx diff --git a/.github/workflows/beta-release.yml b/.github/workflows/beta-release.yml index 96901dca2..b882cbf2d 100644 --- a/.github/workflows/beta-release.yml +++ b/.github/workflows/beta-release.yml @@ -13,15 +13,15 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - # Get the previous package version from .github/latest - - name: Get previous package version from .github/latest + # Get the previous package version from latest + - name: Get previous package version from latest id: get_prev_version - run: echo "::set-output name=prev_version::$(cat .github/latest)" + run: echo "::set-output name=prev_version::$(cat latest)" - # Get the current package version from .github/latest + # Get the current package version from latest - name: Get current package version id: get_current_version - run: echo "::set-output name=current_version::$(cat .github/latest)" + run: echo "::set-output name=current_version::$(cat latest)" # Compare the previous and current versions - name: Compare versions diff --git a/Dockerfile b/Dockerfile index c06be2ee1..fc4bc4db6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,10 @@ # Build Stage FROM --platform=$BUILDPLATFORM python:3.12.0-alpine +# Copy over version +WORKDIR /data +COPY latest latest + ####################### # Backend Build Stage # ####################### @@ -48,13 +52,9 @@ RUN cp /usr/share/zoneinfo/UTC /etc/localtime \ # Set environment variables ENV TZ=Etc/UTC -# Get the version from package.json in the ./ directory -COPY ./package.json ./version.json - LABEL maintainer="Ashley Bailey " LABEL description="Wizarr is an advanced user invitation and management system for Jellyfin, Plex, Emby etc." - # Expose ports EXPOSE 5690 WORKDIR /data/backend diff --git a/backend/app/utils/software_lifecycle.py b/backend/app/utils/software_lifecycle.py index 01dde8570..099a4aa83 100644 --- a/backend/app/utils/software_lifecycle.py +++ b/backend/app/utils/software_lifecycle.py @@ -23,9 +23,9 @@ def get_latest_beta_version(): return None def get_current_version(): - package = path.abspath(path.join(path.dirname(__file__), "../", "../", "../", "package.json")) + package = path.abspath(path.join(path.dirname(__file__), "../", "../", "../", "latest")) with open(package, "r", encoding="utf-8") as f: - return parse(load(f)["version"]) + return parse(f.read()) def is_beta(): diff --git a/.github/latest b/latest similarity index 100% rename from .github/latest rename to latest diff --git a/package.json b/package.json deleted file mode 100644 index 065ae4ccb..000000000 --- a/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version": "3.4.0" -} \ No newline at end of file From 763fc3ee9caaf26c6e30a6ac4096316413519e35 Mon Sep 17 00:00:00 2001 From: Ashley Date: Fri, 6 Oct 2023 09:21:16 +0100 Subject: [PATCH 2/2] Bump to 3.4.1 --- latest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/latest b/latest index fbcbf7380..8cf6caf56 100644 --- a/latest +++ b/latest @@ -1 +1 @@ -3.4.0 \ No newline at end of file +3.4.1 \ No newline at end of file