From 223a40f0352705e2e240040c6b0c11db7eafc09c Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Thu, 1 Aug 2024 15:48:20 +0200 Subject: [PATCH 01/76] ci: add cross-rs build --- .github/workflows/main.yaml | 68 +++++++++++++++++++++++++++++++++++++ Cross.toml | 2 ++ ci/cross-pre-build.sh | 7 ++++ 3 files changed, 77 insertions(+) create mode 100644 .github/workflows/main.yaml create mode 100644 Cross.toml create mode 100644 ci/cross-pre-build.sh diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000000..1723305350 --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,68 @@ +name: Main + +permissions: + contents: read + packages: write + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + workflow_dispatch: + +jobs: + build-backend: + strategy: + fail-fast: false + matrix: + platform: + - target: x86_64-unknown-linux-gnu + command: cargo + - target: aarch64-unknown-linux-gnu + command: cross + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Extract build information + id: build + env: + TARGET: ${{ matrix.platform.target }} + run: | + echo "env=${TARGET##*-}" >> "$GITHUB_OUTPUT" + echo "arch=$(echo $TARGET | cut -d '-' -f1)" >> "$GITHUB_OUTPUT" + echo "docker-arch=${{ startsWith(matrix.platform.target, 'x86_64') && 'amd64' || 'arm64' }}" >> "$GITHUB_OUTPUT" + echo "profile=${{ (github.event_name == 'release' || github.event_name == 'workflow_dispatch') && 'release' || 'dev' }}" >> "$GITHUB_OUTPUT" + echo "output-dir=${{ (github.event_name == 'release' || github.event_name == 'workflow_dispatch') && 'release' || 'debug' }}" >> "$GITHUB_OUTPUT" + - name: Extract rust toolchain + id: toolchain + run: | + echo "channel=$(grep channel rust-toolchain.toml | awk -F' = ' '{printf $2}' | tr -d '\"')" >> "$GITHUB_OUTPUT" + - uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ steps.toolchain.outputs.channel }} + - uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.platform.target }}-${{ steps.build.outputs.profile }} + save-if: ${{ github.ref == 'refs/heads/main' }} + + - name: Install cross + if: ${{ matrix.platform.command == 'cross' }} + uses: taiki-e/cache-cargo-install-action@v2 + with: + tool: cross + git: https://github.com/cross-rs/cross + rev: 19be83481fd3e50ea103d800d72e0f8eddb1c90c + locked: false + + - name: Build + run: | + ${{ matrix.platform.command }} build --locked --target ${{ matrix.platform.target }} --profile ${{ steps.build.outputs.profile }} + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ steps.build.outputs.docker-arch }}-${{ steps.build.outputs.env }} + path: ${{ github.workspace }}/target/${{ matrix.platform.target }}/${{ steps.build.outputs.output-dir }}/ryot + retention-days: 1 diff --git a/Cross.toml b/Cross.toml new file mode 100644 index 0000000000..e039f340b8 --- /dev/null +++ b/Cross.toml @@ -0,0 +1,2 @@ +[build] +pre-build = "ci/cross-pre-build.sh" diff --git a/ci/cross-pre-build.sh b/ci/cross-pre-build.sh new file mode 100644 index 0000000000..3b15d0e343 --- /dev/null +++ b/ci/cross-pre-build.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +set -euxo pipefail + +if [[ "$CROSS_TARGET" == "aarch64-unknown-linux-gnu" ]]; then + dpkg --add-architecture $CROSS_DEB_ARCH + apt-get update && apt-get --assume-yes install libssl-dev:$CROSS_DEB_ARCH +fi From 93d9ba3ce3bddb5dd4e158e06fa9d64a8a5d4322 Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Thu, 1 Aug 2024 16:08:57 +0200 Subject: [PATCH 02/76] add missing env --- .github/workflows/main.yaml | 5 +++++ Cross.toml | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 1723305350..3daa084939 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -31,6 +31,7 @@ jobs: env: TARGET: ${{ matrix.platform.target }} run: | + echo "version=${GITHUB_REF##*/}" >> "$GITHUB_OUTPUT" echo "env=${TARGET##*-}" >> "$GITHUB_OUTPUT" echo "arch=$(echo $TARGET | cut -d '-' -f1)" >> "$GITHUB_OUTPUT" echo "docker-arch=${{ startsWith(matrix.platform.target, 'x86_64') && 'amd64' || 'arm64' }}" >> "$GITHUB_OUTPUT" @@ -58,6 +59,10 @@ jobs: locked: false - name: Build + env: + APP_VERSION: ${{ steps.build.outputs.version }} + DEFAULT_TMDB_ACCESS_TOKEN: ${{ secrets.DEFAULT_TMDB_ACCESS_TOKEN }} + DEFAULT_MAL_CLIENT_ID: ${{ secrets.DEFAULT_MAL_CLIENT_ID }} run: | ${{ matrix.platform.command }} build --locked --target ${{ matrix.platform.target }} --profile ${{ steps.build.outputs.profile }} - name: Upload build artifact diff --git a/Cross.toml b/Cross.toml index e039f340b8..71d3ad73c1 100644 --- a/Cross.toml +++ b/Cross.toml @@ -1,2 +1,9 @@ +[build.env] +passthrough = [ + "APP_VERSION", + "DEFAULT_TMDB_ACCESS_TOKEN", + "DEFAULT_MAL_CLIENT_ID", +] + [build] pre-build = "ci/cross-pre-build.sh" From e79903d9365ed67586daf72dba291d4061d9aafd Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Thu, 1 Aug 2024 16:21:52 +0200 Subject: [PATCH 03/76] add env file --- .github/workflows/main.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 3daa084939..78e75706fb 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -64,6 +64,7 @@ jobs: DEFAULT_TMDB_ACCESS_TOKEN: ${{ secrets.DEFAULT_TMDB_ACCESS_TOKEN }} DEFAULT_MAL_CLIENT_ID: ${{ secrets.DEFAULT_MAL_CLIENT_ID }} run: | + touch .env ${{ matrix.platform.command }} build --locked --target ${{ matrix.platform.target }} --profile ${{ steps.build.outputs.profile }} - name: Upload build artifact uses: actions/upload-artifact@v4 From d0a261c64f292f3a86d8930f44dfa3764917817f Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Thu, 1 Aug 2024 16:48:00 +0200 Subject: [PATCH 04/76] add build frontend --- .github/workflows/main.yaml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 78e75706fb..72996819b6 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -12,7 +12,41 @@ on: workflow_dispatch: jobs: + build-frontend: + runs-on: ubuntu-latest + env: + MOON_TOOLCHAIN_FORCE_GLOBALS: true + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "20.10" + - name: Install build tools + run: | + npm install -g @moonrepo/cli + moon --version + - name: Build frontend + run: | + moon docker scaffold frontend transactional + moon docker setup + moon run frontend:build transactional:build + moon docker prune + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: frontend + path: | + backend/templates/ + frontend/node_modules/ + frontend/package.json + frontend/build/ + retention-days: 1 + build-backend: + needs: + - build-frontend + strategy: fail-fast: false matrix: From 57507d75e7e521f4fde1d0de6d128d1f40a0e787 Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Thu, 1 Aug 2024 21:59:39 +0200 Subject: [PATCH 05/76] use moonrepo setup toolchain --- .github/workflows/main.yaml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 72996819b6..1f0b0c7db3 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -19,19 +19,12 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - uses: moonrepo/setup-toolchain@v0 with: - node-version: "20.10" - - name: Install build tools - run: | - npm install -g @moonrepo/cli - moon --version + auto-install: true - name: Build frontend run: | - moon docker scaffold frontend transactional - moon docker setup - moon run frontend:build transactional:build - moon docker prune + moon ci - name: Upload build artifact uses: actions/upload-artifact@v4 with: From 623f802b7c2b20dc525de24df8d9eccd7265cd72 Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Thu, 1 Aug 2024 22:02:19 +0200 Subject: [PATCH 06/76] use moon docker --- .github/workflows/main.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 1f0b0c7db3..c047c81bb7 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -24,7 +24,9 @@ jobs: auto-install: true - name: Build frontend run: | - moon ci + moon docker scaffold frontend transactional + moon docker setup + moon run frontend:build transactional:build - name: Upload build artifact uses: actions/upload-artifact@v4 with: From 61b493b3885ce29e776d2a1930ca3b18ce003fd2 Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Fri, 2 Aug 2024 07:11:08 +0200 Subject: [PATCH 07/76] delete docker setup --- .github/workflows/main.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index c047c81bb7..f515f77f2a 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -24,8 +24,6 @@ jobs: auto-install: true - name: Build frontend run: | - moon docker scaffold frontend transactional - moon docker setup moon run frontend:build transactional:build - name: Upload build artifact uses: actions/upload-artifact@v4 From 962186c4886effa7f7e5c4b43b9c94d1dec5bd60 Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Fri, 2 Aug 2024 07:20:17 +0200 Subject: [PATCH 08/76] add artifact path --- .github/workflows/main.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index f515f77f2a..c9026a1661 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -30,10 +30,10 @@ jobs: with: name: frontend path: | - backend/templates/ - frontend/node_modules/ - frontend/package.json - frontend/build/ + apps/backend/templates/ + apps/frontend/node_modules/ + apps/frontend/package.json + apps/frontend/build/ retention-days: 1 build-backend: From d131576fbd88dcafa9193e4f33e4426cb07f0271 Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Fri, 2 Aug 2024 07:39:01 +0200 Subject: [PATCH 09/76] download templates --- .github/workflows/main.yaml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index c9026a1661..9691c31792 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -25,12 +25,18 @@ jobs: - name: Build frontend run: | moon run frontend:build transactional:build - - name: Upload build artifact + - name: Upload templates artifact uses: actions/upload-artifact@v4 with: - name: frontend + name: templates path: | apps/backend/templates/ + retention-days: 1 + - name: Upload frontend artifact + uses: actions/upload-artifact@v4 + with: + name: frontend + path: | apps/frontend/node_modules/ apps/frontend/package.json apps/frontend/build/ @@ -53,6 +59,9 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: templates - name: Extract build information id: build env: From b0a9f8ec34d101f320e9c9959821805df1fe6af5 Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Fri, 2 Aug 2024 07:49:22 +0200 Subject: [PATCH 10/76] add path --- .github/workflows/main.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 9691c31792..5bf7a5d726 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -62,6 +62,7 @@ jobs: - uses: actions/download-artifact@v4 with: name: templates + path: app/backend/ - name: Extract build information id: build env: From e5d2ded1b83156757dc29b6e9c9110157cc7dce9 Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Fri, 2 Aug 2024 08:27:54 +0200 Subject: [PATCH 11/76] add path --- .github/workflows/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 5bf7a5d726..197d93ba46 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -62,7 +62,7 @@ jobs: - uses: actions/download-artifact@v4 with: name: templates - path: app/backend/ + path: app/backend/templates/ - name: Extract build information id: build env: From 343ead8fcc8611f5d207faf571dd04455e8eabc0 Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Fri, 2 Aug 2024 08:39:10 +0200 Subject: [PATCH 12/76] add ls --- .github/workflows/main.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 197d93ba46..d5e3fd06da 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -62,7 +62,10 @@ jobs: - uses: actions/download-artifact@v4 with: name: templates - path: app/backend/templates/ + path: app/backend/ + - run: | + ls -a app/backend/ + ls -a app/backend/templates/ - name: Extract build information id: build env: From e1827ed72b0fdda89dc84030619a89317709bd5e Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Fri, 2 Aug 2024 08:43:20 +0200 Subject: [PATCH 13/76] add templates --- .github/workflows/main.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index d5e3fd06da..63ea424be3 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -62,9 +62,8 @@ jobs: - uses: actions/download-artifact@v4 with: name: templates - path: app/backend/ + path: app/backend/templates/ - run: | - ls -a app/backend/ ls -a app/backend/templates/ - name: Extract build information id: build From b341a153bd20a8e6537f82947df9ce28ac7b0f4f Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Fri, 2 Aug 2024 08:48:33 +0200 Subject: [PATCH 14/76] use abs --- .github/workflows/main.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 63ea424be3..e05e90d527 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -62,9 +62,7 @@ jobs: - uses: actions/download-artifact@v4 with: name: templates - path: app/backend/templates/ - - run: | - ls -a app/backend/templates/ + path: ${{ github.workspace }}/app/backend/templates/ - name: Extract build information id: build env: From f786d5637549d35bffcdc9498c6af9225aafa0f0 Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Fri, 2 Aug 2024 08:56:54 +0200 Subject: [PATCH 15/76] typo --- .github/workflows/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index e05e90d527..3f93667738 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -62,7 +62,7 @@ jobs: - uses: actions/download-artifact@v4 with: name: templates - path: ${{ github.workspace }}/app/backend/templates/ + path: ${{ github.workspace }}/apps/backend/templates/ - name: Extract build information id: build env: From 4c8b719bd804d1254597bf70339706327fb9493d Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Fri, 2 Aug 2024 09:08:19 +0200 Subject: [PATCH 16/76] rename artifact --- .github/workflows/main.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 3f93667738..3fc23871d2 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -69,8 +69,6 @@ jobs: TARGET: ${{ matrix.platform.target }} run: | echo "version=${GITHUB_REF##*/}" >> "$GITHUB_OUTPUT" - echo "env=${TARGET##*-}" >> "$GITHUB_OUTPUT" - echo "arch=$(echo $TARGET | cut -d '-' -f1)" >> "$GITHUB_OUTPUT" echo "docker-arch=${{ startsWith(matrix.platform.target, 'x86_64') && 'amd64' || 'arm64' }}" >> "$GITHUB_OUTPUT" echo "profile=${{ (github.event_name == 'release' || github.event_name == 'workflow_dispatch') && 'release' || 'dev' }}" >> "$GITHUB_OUTPUT" echo "output-dir=${{ (github.event_name == 'release' || github.event_name == 'workflow_dispatch') && 'release' || 'debug' }}" >> "$GITHUB_OUTPUT" @@ -106,6 +104,6 @@ jobs: - name: Upload build artifact uses: actions/upload-artifact@v4 with: - name: ${{ steps.build.outputs.docker-arch }}-${{ steps.build.outputs.env }} + name: backend-${{ steps.build.outputs.docker-arch }} path: ${{ github.workspace }}/target/${{ matrix.platform.target }}/${{ steps.build.outputs.output-dir }}/ryot retention-days: 1 From 8ffe5d73e96359c81d9bfecfc8fdd564984ec880 Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Fri, 2 Aug 2024 09:34:46 +0200 Subject: [PATCH 17/76] add build docker --- .github/workflows/main.yaml | 35 +++++++++++++++++++++++++++++++++++ Dockerfile.new | 30 ++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 Dockerfile.new diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 3fc23871d2..1c7254d33b 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -107,3 +107,38 @@ jobs: name: backend-${{ steps.build.outputs.docker-arch }} path: ${{ github.workspace }}/target/${{ matrix.platform.target }}/${{ steps.build.outputs.output-dir }}/ryot retention-days: 1 + + build-docker: + needs: + - build-frontend + - build-backend + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Download build artifact for docker + uses: actions/download-artifact@v4 + with: + path: ${{ github.workspace }}/artifact/ + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to the ghcr container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.GHCR_REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push to ghcr + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.new + platforms: linux/amd64,linux/arm64 + push: true + tags: vnghia/ryot:test diff --git a/Dockerfile.new b/Dockerfile.new new file mode 100644 index 0000000000..c7cc58fb5a --- /dev/null +++ b/Dockerfile.new @@ -0,0 +1,30 @@ +ARG NODE_BASE_IMAGE=node:20.10.0-bookworm-slim + +FROM --platform=${BUILDPLATFORM} alpine as artifact +COPY artifact/ /artifact/ +ARG TARGETARCH +ENV TARGETARCH=${TARGETARCH} +RUN mv /artifact/backend-${TARGETARCH}/ryot /artifact/ryot +RUN chmod +x /artifact/ryot + +FROM $NODE_BASE_IMAGE +LABEL org.opencontainers.image.source="https://github.com/IgnisDa/ryot" +ENV FRONTEND_UMAMI_SCRIPT_URL="https://umami.diptesh.me/script.js" +ENV FRONTEND_UMAMI_WEBSITE_ID="5ecd6915-d542-4fda-aa5f-70f09f04e2e0" +COPY --from=caddy:2.7.5 /usr/bin/caddy /usr/local/bin/caddy +RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates && rm -rf /var/lib/apt/lists/* +RUN npm install --global concurrently@8.2.2 && concurrently --version +RUN useradd -m -u 1001 ryot +WORKDIR /home/ryot +USER ryot +COPY ci/Caddyfile /etc/caddy/Caddyfile +COPY --from=artifact --chown=ryot:ryot /artifact/frontend/node_modules ./node_modules +COPY --from=artifact --chown=ryot:ryot /artifact/frontend/package.json ./package.json +COPY --from=artifact --chown=ryot:ryot /artifact/frontend/build ./build +COPY --from=artifact --chown=ryot:ryot /artifact/ryot /usr/local/bin/ryot +CMD [ \ + "concurrently", "--names", "frontend,backend,proxy", "--kill-others", \ + "PORT=3000 npx remix-serve ./build/server/index.js", \ + "BACKEND_PORT=5000 /usr/local/bin/ryot", \ + "caddy run --config /etc/caddy/Caddyfile" \ +] From f72a7051cf19099d6ad12c19e53b243ba839e5dd Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Fri, 2 Aug 2024 09:45:56 +0200 Subject: [PATCH 18/76] env permission --- .github/workflows/main.yaml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 1c7254d33b..bc56ec220a 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -1,9 +1,5 @@ name: Main -permissions: - contents: read - packages: write - on: push: branches: ["main"] @@ -11,6 +7,13 @@ on: branches: ["main"] workflow_dispatch: +env: + GHCR_REGISTRY: ghcr.io + +permissions: + contents: write + packages: write + jobs: build-frontend: runs-on: ubuntu-latest From cc92427d77d2d57da805630a218599b1f32e89f0 Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Fri, 2 Aug 2024 10:10:39 +0200 Subject: [PATCH 19/76] add ghcr --- .github/workflows/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index bc56ec220a..9180fb78b3 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -144,4 +144,4 @@ jobs: file: Dockerfile.new platforms: linux/amd64,linux/arm64 push: true - tags: vnghia/ryot:test + tags: ghcr.io/vnghia/ryot:test From af6376bf0dc0e58ce39c65e3daad661cb4609a75 Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Fri, 2 Aug 2024 10:30:00 +0200 Subject: [PATCH 20/76] add libssl --- Dockerfile.new | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile.new b/Dockerfile.new index c7cc58fb5a..1c80473b1b 100644 --- a/Dockerfile.new +++ b/Dockerfile.new @@ -12,7 +12,7 @@ LABEL org.opencontainers.image.source="https://github.com/IgnisDa/ryot" ENV FRONTEND_UMAMI_SCRIPT_URL="https://umami.diptesh.me/script.js" ENV FRONTEND_UMAMI_WEBSITE_ID="5ecd6915-d542-4fda-aa5f-70f09f04e2e0" COPY --from=caddy:2.7.5 /usr/bin/caddy /usr/local/bin/caddy -RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates libssl && rm -rf /var/lib/apt/lists/* RUN npm install --global concurrently@8.2.2 && concurrently --version RUN useradd -m -u 1001 ryot WORKDIR /home/ryot @@ -27,4 +27,4 @@ CMD [ \ "PORT=3000 npx remix-serve ./build/server/index.js", \ "BACKEND_PORT=5000 /usr/local/bin/ryot", \ "caddy run --config /etc/caddy/Caddyfile" \ -] + ] From 27af5f1194f2c22d9c1bb5ee079d5008a5302c4b Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Fri, 2 Aug 2024 10:51:13 +0200 Subject: [PATCH 21/76] openssl --- Dockerfile.new | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.new b/Dockerfile.new index 1c80473b1b..77fe0d0a57 100644 --- a/Dockerfile.new +++ b/Dockerfile.new @@ -12,7 +12,7 @@ LABEL org.opencontainers.image.source="https://github.com/IgnisDa/ryot" ENV FRONTEND_UMAMI_SCRIPT_URL="https://umami.diptesh.me/script.js" ENV FRONTEND_UMAMI_WEBSITE_ID="5ecd6915-d542-4fda-aa5f-70f09f04e2e0" COPY --from=caddy:2.7.5 /usr/bin/caddy /usr/local/bin/caddy -RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates libssl && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates openssl && rm -rf /var/lib/apt/lists/* RUN npm install --global concurrently@8.2.2 && concurrently --version RUN useradd -m -u 1001 ryot WORKDIR /home/ryot From fd956b6ec98f3c8c08ebfbe106fdcebf7cd56ed1 Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Fri, 2 Aug 2024 11:05:22 +0200 Subject: [PATCH 22/76] remove curl --- Dockerfile.new | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile.new b/Dockerfile.new index 77fe0d0a57..686857c460 100644 --- a/Dockerfile.new +++ b/Dockerfile.new @@ -12,7 +12,7 @@ LABEL org.opencontainers.image.source="https://github.com/IgnisDa/ryot" ENV FRONTEND_UMAMI_SCRIPT_URL="https://umami.diptesh.me/script.js" ENV FRONTEND_UMAMI_WEBSITE_ID="5ecd6915-d542-4fda-aa5f-70f09f04e2e0" COPY --from=caddy:2.7.5 /usr/bin/caddy /usr/local/bin/caddy -RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates openssl && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y --no-install-recommends openssl ca-certificates && rm -rf /var/lib/apt/lists/* RUN npm install --global concurrently@8.2.2 && concurrently --version RUN useradd -m -u 1001 ryot WORKDIR /home/ryot @@ -27,4 +27,4 @@ CMD [ \ "PORT=3000 npx remix-serve ./build/server/index.js", \ "BACKEND_PORT=5000 /usr/local/bin/ryot", \ "caddy run --config /etc/caddy/Caddyfile" \ - ] +] From e30bd3607343007a711e43d46870e4f58a4b112d Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Fri, 2 Aug 2024 11:42:39 +0200 Subject: [PATCH 23/76] add tar --- .github/workflows/main.yaml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 9180fb78b3..c86f931fb9 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -35,14 +35,18 @@ jobs: path: | apps/backend/templates/ retention-days: 1 + - name: Archive frontend directory + run: | + tar -cvf node_modules.tar apps/frontend/node_modules/ + tar -cvf build.tar apps/frontend/build/ - name: Upload frontend artifact uses: actions/upload-artifact@v4 with: name: frontend path: | - apps/frontend/node_modules/ + node_modules.tar + build.tar apps/frontend/package.json - apps/frontend/build/ retention-days: 1 build-backend: @@ -123,7 +127,10 @@ jobs: uses: actions/download-artifact@v4 with: path: ${{ github.workspace }}/artifact/ - + - name: Unarchive frontend directory + run: | + tar -xvf node_modules.tar -C artifact/frontend/ + tar -xvf build.tar -C artifact/frontend/ - name: Set up QEMU uses: docker/setup-qemu-action@v3 From 444af175eb0a181121a4c61440a015768d74e6c2 Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Fri, 2 Aug 2024 11:56:17 +0200 Subject: [PATCH 24/76] add path --- .github/workflows/main.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index c86f931fb9..3f315c425e 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -129,8 +129,8 @@ jobs: path: ${{ github.workspace }}/artifact/ - name: Unarchive frontend directory run: | - tar -xvf node_modules.tar -C artifact/frontend/ - tar -xvf build.tar -C artifact/frontend/ + tar -xvf artifact/node_modules.tar -C artifact/frontend/ + tar -xvf artifact/build.tar -C artifact/frontend/ - name: Set up QEMU uses: docker/setup-qemu-action@v3 From 3f2a1a08ef4c3e6a4f46cc7bcfa46855eafd1b88 Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Fri, 2 Aug 2024 12:14:42 +0200 Subject: [PATCH 25/76] cd --- .github/workflows/main.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 3f315c425e..79d3d015bb 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -129,8 +129,9 @@ jobs: path: ${{ github.workspace }}/artifact/ - name: Unarchive frontend directory run: | - tar -xvf artifact/node_modules.tar -C artifact/frontend/ - tar -xvf artifact/build.tar -C artifact/frontend/ + cd artifact/frontend/ + tar -xvf node_modules.tar + tar -xvf build.tar - name: Set up QEMU uses: docker/setup-qemu-action@v3 From 6218d413891ac0cfdd78faf48bc40765466f5236 Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Fri, 2 Aug 2024 12:26:30 +0200 Subject: [PATCH 26/76] --strip-components --- .github/workflows/main.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 79d3d015bb..1bfd7fc5da 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -130,8 +130,8 @@ jobs: - name: Unarchive frontend directory run: | cd artifact/frontend/ - tar -xvf node_modules.tar - tar -xvf build.tar + tar -xvf node_modules.tar --strip-components 2 + tar -xvf build.tar --strip-components 2 - name: Set up QEMU uses: docker/setup-qemu-action@v3 From a825e3f673128df832198b4a313c07e95ee1d67a Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Fri, 2 Aug 2024 12:43:08 +0200 Subject: [PATCH 27/76] cd --- .github/workflows/main.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 1bfd7fc5da..4301f9f592 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -37,8 +37,9 @@ jobs: retention-days: 1 - name: Archive frontend directory run: | - tar -cvf node_modules.tar apps/frontend/node_modules/ - tar -cvf build.tar apps/frontend/build/ + cd apps/frontend/ + tar -cvf node_modules.tar node_modules/ + tar -cvf build.tar build/ - name: Upload frontend artifact uses: actions/upload-artifact@v4 with: @@ -130,8 +131,8 @@ jobs: - name: Unarchive frontend directory run: | cd artifact/frontend/ - tar -xvf node_modules.tar --strip-components 2 - tar -xvf build.tar --strip-components 2 + tar -xvf node_modules.tar + tar -xvf build.tar - name: Set up QEMU uses: docker/setup-qemu-action@v3 From a11ef877243c38d8be27b7dcfc6a56221e24203e Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Fri, 2 Aug 2024 12:55:14 +0200 Subject: [PATCH 28/76] apps/frontend/ --- .github/workflows/main.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 4301f9f592..64c38f93ba 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -45,8 +45,8 @@ jobs: with: name: frontend path: | - node_modules.tar - build.tar + apps/frontend/node_modules.tar + apps/frontend/build.tar apps/frontend/package.json retention-days: 1 From a5cc36d2885256978b00ce713841e59db7a886c9 Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Mon, 5 Aug 2024 06:42:06 +0200 Subject: [PATCH 29/76] build frontend twice --- .github/workflows/main.yaml | 21 +-------------------- Dockerfile.new | 25 ++++++++++++++++++++++--- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 64c38f93ba..ce1bbb9abe 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -35,20 +35,6 @@ jobs: path: | apps/backend/templates/ retention-days: 1 - - name: Archive frontend directory - run: | - cd apps/frontend/ - tar -cvf node_modules.tar node_modules/ - tar -cvf build.tar build/ - - name: Upload frontend artifact - uses: actions/upload-artifact@v4 - with: - name: frontend - path: | - apps/frontend/node_modules.tar - apps/frontend/build.tar - apps/frontend/package.json - retention-days: 1 build-backend: needs: @@ -118,7 +104,6 @@ jobs: build-docker: needs: - - build-frontend - build-backend runs-on: ubuntu-latest @@ -128,11 +113,7 @@ jobs: uses: actions/download-artifact@v4 with: path: ${{ github.workspace }}/artifact/ - - name: Unarchive frontend directory - run: | - cd artifact/frontend/ - tar -xvf node_modules.tar - tar -xvf build.tar + - name: Set up QEMU uses: docker/setup-qemu-action@v3 diff --git a/Dockerfile.new b/Dockerfile.new index 686857c460..c61837c632 100644 --- a/Dockerfile.new +++ b/Dockerfile.new @@ -1,5 +1,24 @@ ARG NODE_BASE_IMAGE=node:20.10.0-bookworm-slim +FROM $NODE_BASE_IMAGE AS frontend-build-base +ENV MOON_TOOLCHAIN_FORCE_GLOBALS=true +WORKDIR /app +RUN apt update && apt install -y --no-install-recommends git curl ca-certificates xz-utils +RUN npm install -g @moonrepo/cli && moon --version + +FROM frontend-build-base AS frontend-workspace +WORKDIR /app +COPY . . +RUN moon docker scaffold frontend transactional + +FROM frontend-build-base AS frontend-builder +WORKDIR /app +COPY --from=frontend-workspace /app/.moon/docker/workspace . +RUN moon docker setup +COPY --from=frontend-workspace /app/.moon/docker/sources . +RUN moon run frontend:build transactional:build +RUN moon docker prune + FROM --platform=${BUILDPLATFORM} alpine as artifact COPY artifact/ /artifact/ ARG TARGETARCH @@ -18,9 +37,9 @@ RUN useradd -m -u 1001 ryot WORKDIR /home/ryot USER ryot COPY ci/Caddyfile /etc/caddy/Caddyfile -COPY --from=artifact --chown=ryot:ryot /artifact/frontend/node_modules ./node_modules -COPY --from=artifact --chown=ryot:ryot /artifact/frontend/package.json ./package.json -COPY --from=artifact --chown=ryot:ryot /artifact/frontend/build ./build +COPY --from=frontend-builder --chown=ryot:ryot /app/apps/frontend/node_modules ./node_modules +COPY --from=frontend-builder --chown=ryot:ryot /app/apps/frontend/package.json ./package.json +COPY --from=frontend-builder --chown=ryot:ryot /app/apps/frontend/build ./build COPY --from=artifact --chown=ryot:ryot /artifact/ryot /usr/local/bin/ryot CMD [ \ "concurrently", "--names", "frontend,backend,proxy", "--kill-others", \ From fe54d62328fa6ebd16686d0f57a83a7c80d5c2fd Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Tue, 6 Aug 2024 05:00:41 +0200 Subject: [PATCH 30/76] remove debug assertion --- apps/backend/src/main.rs | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/apps/backend/src/main.rs b/apps/backend/src/main.rs index 0470753769..f959709529 100644 --- a/apps/backend/src/main.rs +++ b/apps/backend/src/main.rs @@ -179,37 +179,6 @@ async fn main() -> Result<()> { .unwrap(); } - if cfg!(debug_assertions) { - use schematic::schema::{SchemaGenerator, TypeScriptRenderer, YamlTemplateRenderer}; - - // TODO: Once https://github.com/rust-lang/cargo/issues/3946 is resolved - let base_dir = PathBuf::from(BASE_DIR) - .parent() - .unwrap() - .parent() - .unwrap() - .join("docs") - .join("includes"); - - let mut generator = SchemaGenerator::default(); - generator.add::(); - generator - .generate( - base_dir.join("backend-config-schema.yaml"), - YamlTemplateRenderer::default(), - ) - .unwrap(); - - let mut generator = SchemaGenerator::default(); - generator.add::(); - generator - .generate( - base_dir.join("export-schema.ts"), - TypeScriptRenderer::default(), - ) - .unwrap(); - } - let schema = get_schema(&app_services).await; let cors = TowerCorsLayer::new() From 1ba0c96ac77898b6cde0ae3e663faf8ebd04f66f Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Tue, 6 Aug 2024 23:00:12 +0200 Subject: [PATCH 31/76] build on host --- .github/workflows/main.yaml | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index ce1bbb9abe..b12cb12d04 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -45,9 +45,7 @@ jobs: matrix: platform: - target: x86_64-unknown-linux-gnu - command: cargo - target: aarch64-unknown-linux-gnu - command: cross runs-on: ubuntu-latest @@ -78,14 +76,12 @@ jobs: key: ${{ matrix.platform.target }}-${{ steps.build.outputs.profile }} save-if: ${{ github.ref == 'refs/heads/main' }} - - name: Install cross - if: ${{ matrix.platform.command == 'cross' }} - uses: taiki-e/cache-cargo-install-action@v2 - with: - tool: cross - git: https://github.com/cross-rs/cross - rev: 19be83481fd3e50ea103d800d72e0f8eddb1c90c - locked: false + - name: Setup arm64 environment + run: | + dpkg --add-architecture arm64 + sudo apt update + sudo apt install --assume-yes gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libssl-dev:arm64 + if: ${{ matrix.platform.target == 'aarch64-unknown-linux-gnu' }} - name: Build env: @@ -94,7 +90,7 @@ jobs: DEFAULT_MAL_CLIENT_ID: ${{ secrets.DEFAULT_MAL_CLIENT_ID }} run: | touch .env - ${{ matrix.platform.command }} build --locked --target ${{ matrix.platform.target }} --profile ${{ steps.build.outputs.profile }} + cargo build --locked --target ${{ matrix.platform.target }} --profile ${{ steps.build.outputs.profile }} - name: Upload build artifact uses: actions/upload-artifact@v4 with: From cf9a6a9d11758423bf88e5787bd80395c47182e0 Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Tue, 6 Aug 2024 23:03:04 +0200 Subject: [PATCH 32/76] sudo --- .github/workflows/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index b12cb12d04..45e863f172 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -78,7 +78,7 @@ jobs: - name: Setup arm64 environment run: | - dpkg --add-architecture arm64 + sudo dpkg --add-architecture arm64 sudo apt update sudo apt install --assume-yes gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libssl-dev:arm64 if: ${{ matrix.platform.target == 'aarch64-unknown-linux-gnu' }} From 5e5d48085027a38b854a8ce4ad0108bc68283a6a Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Tue, 6 Aug 2024 23:16:35 +0200 Subject: [PATCH 33/76] arm64 --- .github/workflows/main.yaml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 45e863f172..a8abfb7301 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -76,11 +76,15 @@ jobs: key: ${{ matrix.platform.target }}-${{ steps.build.outputs.profile }} save-if: ${{ github.ref == 'refs/heads/main' }} + - name: Setup arm64 libssl + uses: ryankurte/action-apt@v0.4.0 + with: + arch: arm64 + packages: "libsqlite3-dev:arm64" + if: ${{ matrix.platform.target == 'aarch64-unknown-linux-gnu' }} - name: Setup arm64 environment run: | - sudo dpkg --add-architecture arm64 - sudo apt update - sudo apt install --assume-yes gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libssl-dev:arm64 + sudo apt install --assume-yes gcc-aarch64-linux-gnu g++-aarch64-linux-gnu if: ${{ matrix.platform.target == 'aarch64-unknown-linux-gnu' }} - name: Build From 8bab55c88b2320a70a22530403bbae28ebd95bb0 Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Wed, 7 Aug 2024 00:19:46 +0200 Subject: [PATCH 34/76] arm64 --- .github/workflows/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index a8abfb7301..c96d44fb75 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -77,7 +77,7 @@ jobs: save-if: ${{ github.ref == 'refs/heads/main' }} - name: Setup arm64 libssl - uses: ryankurte/action-apt@v0.4.0 + uses: ryankurte/action-apt@v0.4.1 with: arch: arm64 packages: "libsqlite3-dev:arm64" From ded239b5a0ffe084f858f0209eac652d1a18b3e0 Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Wed, 7 Aug 2024 00:23:43 +0200 Subject: [PATCH 35/76] libssl --- .github/workflows/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index c96d44fb75..f442a6fa6b 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -80,7 +80,7 @@ jobs: uses: ryankurte/action-apt@v0.4.1 with: arch: arm64 - packages: "libsqlite3-dev:arm64" + packages: "libssl-dev:arm64" if: ${{ matrix.platform.target == 'aarch64-unknown-linux-gnu' }} - name: Setup arm64 environment run: | From ecfc707a6d0f2c758dc87533add80c89554b5302 Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Wed, 7 Aug 2024 00:26:04 +0200 Subject: [PATCH 36/76] rustup --- .github/workflows/main.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index f442a6fa6b..5aa5605dec 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -71,6 +71,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: toolchain: ${{ steps.toolchain.outputs.channel }} + targets: ${{ matrix.platform.target }} - uses: Swatinem/rust-cache@v2 with: key: ${{ matrix.platform.target }}-${{ steps.build.outputs.profile }} From 4846bfbabaa36241b4a67c1f99699500130a9bfc Mon Sep 17 00:00:00 2001 From: Diptesh Choudhuri Date: Wed, 7 Aug 2024 06:27:09 +0530 Subject: [PATCH 37/76] ci: add new token --- .github/workflows/main.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 5aa5605dec..d0b9afa631 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -93,6 +93,7 @@ jobs: APP_VERSION: ${{ steps.build.outputs.version }} DEFAULT_TMDB_ACCESS_TOKEN: ${{ secrets.DEFAULT_TMDB_ACCESS_TOKEN }} DEFAULT_MAL_CLIENT_ID: ${{ secrets.DEFAULT_MAL_CLIENT_ID }} + DEFAULT_GOOGLE_BOOKS_API_KEY: ${{ secrets.DEFAULT_GOOGLE_BOOKS_API_KEY }} run: | touch .env cargo build --locked --target ${{ matrix.platform.target }} --profile ${{ steps.build.outputs.profile }} From 65ff730a89bff9017b3efcb9a24d62cdec026a46 Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Wed, 7 Aug 2024 07:12:28 +0200 Subject: [PATCH 38/76] set env --- .github/workflows/main.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index d0b9afa631..08f37bda20 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -85,7 +85,9 @@ jobs: if: ${{ matrix.platform.target == 'aarch64-unknown-linux-gnu' }} - name: Setup arm64 environment run: | - sudo apt install --assume-yes gcc-aarch64-linux-gnu g++-aarch64-linux-gnu + sudo apt install --assume-yes crossbuild-essential-arm64 + echo "PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig:/usr/share/pkgconfig" >> "$GITHUB_ENV" + echo "PKG_CONFIG_LIBDIR=/usr/lib/aarch64-linux-gnu" >> "$GITHUB_ENV" if: ${{ matrix.platform.target == 'aarch64-unknown-linux-gnu' }} - name: Build From bee3906ef1153941e4af111dc2bf54e4517bdbeb Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Wed, 7 Aug 2024 08:15:43 +0200 Subject: [PATCH 39/76] Revert "build on host" This reverts commit a47df4e9ea523b2720ce90ea051875611b41f234. --- .github/workflows/main.yaml | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 08f37bda20..9bf758bd10 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -45,7 +45,9 @@ jobs: matrix: platform: - target: x86_64-unknown-linux-gnu + command: cargo - target: aarch64-unknown-linux-gnu + command: cross runs-on: ubuntu-latest @@ -77,18 +79,14 @@ jobs: key: ${{ matrix.platform.target }}-${{ steps.build.outputs.profile }} save-if: ${{ github.ref == 'refs/heads/main' }} - - name: Setup arm64 libssl - uses: ryankurte/action-apt@v0.4.1 + - name: Install cross + if: ${{ matrix.platform.command == 'cross' }} + uses: taiki-e/cache-cargo-install-action@v2 with: - arch: arm64 - packages: "libssl-dev:arm64" - if: ${{ matrix.platform.target == 'aarch64-unknown-linux-gnu' }} - - name: Setup arm64 environment - run: | - sudo apt install --assume-yes crossbuild-essential-arm64 - echo "PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig:/usr/share/pkgconfig" >> "$GITHUB_ENV" - echo "PKG_CONFIG_LIBDIR=/usr/lib/aarch64-linux-gnu" >> "$GITHUB_ENV" - if: ${{ matrix.platform.target == 'aarch64-unknown-linux-gnu' }} + tool: cross + git: https://github.com/cross-rs/cross + rev: 19be83481fd3e50ea103d800d72e0f8eddb1c90c + locked: false - name: Build env: @@ -98,7 +96,7 @@ jobs: DEFAULT_GOOGLE_BOOKS_API_KEY: ${{ secrets.DEFAULT_GOOGLE_BOOKS_API_KEY }} run: | touch .env - cargo build --locked --target ${{ matrix.platform.target }} --profile ${{ steps.build.outputs.profile }} + ${{ matrix.platform.command }} build --locked --target ${{ matrix.platform.target }} --profile ${{ steps.build.outputs.profile }} - name: Upload build artifact uses: actions/upload-artifact@v4 with: From 7a0996a8215a5e42d0b00360e0a7c01331d802cd Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Fri, 9 Aug 2024 21:42:46 +0200 Subject: [PATCH 40/76] install libssl1.1 for arm64 --- Dockerfile.new | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile.new b/Dockerfile.new index c61837c632..fb1e47c8d7 100644 --- a/Dockerfile.new +++ b/Dockerfile.new @@ -27,6 +27,8 @@ RUN mv /artifact/backend-${TARGETARCH}/ryot /artifact/ryot RUN chmod +x /artifact/ryot FROM $NODE_BASE_IMAGE +ARG TARGETARCH +ENV TARGETARCH=${TARGETARCH} LABEL org.opencontainers.image.source="https://github.com/IgnisDa/ryot" ENV FRONTEND_UMAMI_SCRIPT_URL="https://umami.diptesh.me/script.js" ENV FRONTEND_UMAMI_WEBSITE_ID="5ecd6915-d542-4fda-aa5f-70f09f04e2e0" @@ -34,6 +36,7 @@ COPY --from=caddy:2.7.5 /usr/bin/caddy /usr/local/bin/caddy RUN apt-get update && apt-get install -y --no-install-recommends openssl ca-certificates && rm -rf /var/lib/apt/lists/* RUN npm install --global concurrently@8.2.2 && concurrently --version RUN useradd -m -u 1001 ryot +RUN if [ ${TARGETARCH} == "arm64" ]; then apt-get update && apt-get install -y --no-install-recommends wget && wget http://ftp.debian.org/debian/pool/main/o/openssl/libssl1.1_1.1.1w-0+deb11u1_arm64.deb && dpkg -i libssl1.1_1.1.1w-0+deb11u1_arm64.deb && rm -rf libssl1.1_1.1.1w-0+deb11u1_arm64.deb && apt-get remove wget && rm -rf rm -rf /var/lib/apt/lists/*; fi WORKDIR /home/ryot USER ryot COPY ci/Caddyfile /etc/caddy/Caddyfile @@ -46,4 +49,4 @@ CMD [ \ "PORT=3000 npx remix-serve ./build/server/index.js", \ "BACKEND_PORT=5000 /usr/local/bin/ryot", \ "caddy run --config /etc/caddy/Caddyfile" \ -] + ] From fcbbc88d7f5f33161237904ab0a8d732f21fd78f Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Fri, 9 Aug 2024 21:43:10 +0200 Subject: [PATCH 41/76] lint --- Dockerfile.new | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.new b/Dockerfile.new index fb1e47c8d7..c1e44a87bd 100644 --- a/Dockerfile.new +++ b/Dockerfile.new @@ -49,4 +49,4 @@ CMD [ \ "PORT=3000 npx remix-serve ./build/server/index.js", \ "BACKEND_PORT=5000 /usr/local/bin/ryot", \ "caddy run --config /etc/caddy/Caddyfile" \ - ] +] From 56aa50cf64ba20275770e5e9cd4a5137a52d3566 Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Fri, 9 Aug 2024 22:08:27 +0200 Subject: [PATCH 42/76] typo --- Dockerfile.new | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.new b/Dockerfile.new index c1e44a87bd..e44791885d 100644 --- a/Dockerfile.new +++ b/Dockerfile.new @@ -36,7 +36,7 @@ COPY --from=caddy:2.7.5 /usr/bin/caddy /usr/local/bin/caddy RUN apt-get update && apt-get install -y --no-install-recommends openssl ca-certificates && rm -rf /var/lib/apt/lists/* RUN npm install --global concurrently@8.2.2 && concurrently --version RUN useradd -m -u 1001 ryot -RUN if [ ${TARGETARCH} == "arm64" ]; then apt-get update && apt-get install -y --no-install-recommends wget && wget http://ftp.debian.org/debian/pool/main/o/openssl/libssl1.1_1.1.1w-0+deb11u1_arm64.deb && dpkg -i libssl1.1_1.1.1w-0+deb11u1_arm64.deb && rm -rf libssl1.1_1.1.1w-0+deb11u1_arm64.deb && apt-get remove wget && rm -rf rm -rf /var/lib/apt/lists/*; fi +RUN if [ "${TARGETARCH}" == "arm64" ]; then apt-get update && apt-get install -y --no-install-recommends wget && wget http://ftp.debian.org/debian/pool/main/o/openssl/libssl1.1_1.1.1w-0+deb11u1_arm64.deb && dpkg -i libssl1.1_1.1.1w-0+deb11u1_arm64.deb && rm -rf libssl1.1_1.1.1w-0+deb11u1_arm64.deb && apt-get remove wget && rm -rf rm -rf /var/lib/apt/lists/*; fi WORKDIR /home/ryot USER ryot COPY ci/Caddyfile /etc/caddy/Caddyfile From 30c0e240126cd2bf5ce577d837aea24f1c1356ad Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Fri, 9 Aug 2024 22:22:18 +0200 Subject: [PATCH 43/76] typo --- Dockerfile.new | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile.new b/Dockerfile.new index e44791885d..920b5b2a7a 100644 --- a/Dockerfile.new +++ b/Dockerfile.new @@ -33,10 +33,10 @@ LABEL org.opencontainers.image.source="https://github.com/IgnisDa/ryot" ENV FRONTEND_UMAMI_SCRIPT_URL="https://umami.diptesh.me/script.js" ENV FRONTEND_UMAMI_WEBSITE_ID="5ecd6915-d542-4fda-aa5f-70f09f04e2e0" COPY --from=caddy:2.7.5 /usr/bin/caddy /usr/local/bin/caddy -RUN apt-get update && apt-get install -y --no-install-recommends openssl ca-certificates && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y --no-install-recommends libssl3 ca-certificates && rm -rf /var/lib/apt/lists/* RUN npm install --global concurrently@8.2.2 && concurrently --version RUN useradd -m -u 1001 ryot -RUN if [ "${TARGETARCH}" == "arm64" ]; then apt-get update && apt-get install -y --no-install-recommends wget && wget http://ftp.debian.org/debian/pool/main/o/openssl/libssl1.1_1.1.1w-0+deb11u1_arm64.deb && dpkg -i libssl1.1_1.1.1w-0+deb11u1_arm64.deb && rm -rf libssl1.1_1.1.1w-0+deb11u1_arm64.deb && apt-get remove wget && rm -rf rm -rf /var/lib/apt/lists/*; fi +RUN if [[ "${TARGETARCH}" == "arm64" ]]; then apt-get update && apt-get install -y --no-install-recommends wget && wget http://ftp.debian.org/debian/pool/main/o/openssl/libssl1.1_1.1.1w-0+deb11u1_arm64.deb && dpkg -i libssl1.1_1.1.1w-0+deb11u1_arm64.deb && rm -rf libssl1.1_1.1.1w-0+deb11u1_arm64.deb && apt-get remove wget && rm -rf rm -rf /var/lib/apt/lists/*; fi WORKDIR /home/ryot USER ryot COPY ci/Caddyfile /etc/caddy/Caddyfile From 5d4b3a9384c343cf38b7f676cef1d8c57fc79553 Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Fri, 9 Aug 2024 23:37:09 +0200 Subject: [PATCH 44/76] sh not bash --- Dockerfile.new | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.new b/Dockerfile.new index 920b5b2a7a..bd670e5f42 100644 --- a/Dockerfile.new +++ b/Dockerfile.new @@ -36,7 +36,7 @@ COPY --from=caddy:2.7.5 /usr/bin/caddy /usr/local/bin/caddy RUN apt-get update && apt-get install -y --no-install-recommends libssl3 ca-certificates && rm -rf /var/lib/apt/lists/* RUN npm install --global concurrently@8.2.2 && concurrently --version RUN useradd -m -u 1001 ryot -RUN if [[ "${TARGETARCH}" == "arm64" ]]; then apt-get update && apt-get install -y --no-install-recommends wget && wget http://ftp.debian.org/debian/pool/main/o/openssl/libssl1.1_1.1.1w-0+deb11u1_arm64.deb && dpkg -i libssl1.1_1.1.1w-0+deb11u1_arm64.deb && rm -rf libssl1.1_1.1.1w-0+deb11u1_arm64.deb && apt-get remove wget && rm -rf rm -rf /var/lib/apt/lists/*; fi +RUN if [ "${TARGETARCH}" = "arm64" ]; then apt-get update && apt-get install -y --no-install-recommends wget && wget http://ftp.debian.org/debian/pool/main/o/openssl/libssl1.1_1.1.1w-0+deb11u1_arm64.deb && dpkg -i libssl1.1_1.1.1w-0+deb11u1_arm64.deb && rm -rf libssl1.1_1.1.1w-0+deb11u1_arm64.deb && apt-get remove wget && rm -rf rm -rf /var/lib/apt/lists/*; fi WORKDIR /home/ryot USER ryot COPY ci/Caddyfile /etc/caddy/Caddyfile From cc1cecf80a6732ff0ef06b6bff4b78e62c000cac Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Fri, 9 Aug 2024 23:53:07 +0200 Subject: [PATCH 45/76] y --- Dockerfile.new | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.new b/Dockerfile.new index bd670e5f42..218e487057 100644 --- a/Dockerfile.new +++ b/Dockerfile.new @@ -36,7 +36,7 @@ COPY --from=caddy:2.7.5 /usr/bin/caddy /usr/local/bin/caddy RUN apt-get update && apt-get install -y --no-install-recommends libssl3 ca-certificates && rm -rf /var/lib/apt/lists/* RUN npm install --global concurrently@8.2.2 && concurrently --version RUN useradd -m -u 1001 ryot -RUN if [ "${TARGETARCH}" = "arm64" ]; then apt-get update && apt-get install -y --no-install-recommends wget && wget http://ftp.debian.org/debian/pool/main/o/openssl/libssl1.1_1.1.1w-0+deb11u1_arm64.deb && dpkg -i libssl1.1_1.1.1w-0+deb11u1_arm64.deb && rm -rf libssl1.1_1.1.1w-0+deb11u1_arm64.deb && apt-get remove wget && rm -rf rm -rf /var/lib/apt/lists/*; fi +RUN if [ "${TARGETARCH}" = "arm64" ]; then apt-get update && apt-get install -y --no-install-recommends wget && wget http://ftp.debian.org/debian/pool/main/o/openssl/libssl1.1_1.1.1w-0+deb11u1_arm64.deb && dpkg -i libssl1.1_1.1.1w-0+deb11u1_arm64.deb && rm -rf libssl1.1_1.1.1w-0+deb11u1_arm64.deb && apt-get remove -y wget && rm -rf rm -rf /var/lib/apt/lists/*; fi WORKDIR /home/ryot USER ryot COPY ci/Caddyfile /etc/caddy/Caddyfile From 7da3e9319d407044f21330c504c3f76cced158b3 Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Sat, 10 Aug 2024 05:53:30 +0200 Subject: [PATCH 46/76] docker tag --- .github/workflows/main.yaml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 9bf758bd10..de1e023a4f 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -3,9 +3,10 @@ name: Main on: push: branches: ["main"] + tags: + - "*-?v[0-9]+*" pull_request: branches: ["main"] - workflow_dispatch: env: GHCR_REGISTRY: ghcr.io @@ -64,8 +65,8 @@ jobs: run: | echo "version=${GITHUB_REF##*/}" >> "$GITHUB_OUTPUT" echo "docker-arch=${{ startsWith(matrix.platform.target, 'x86_64') && 'amd64' || 'arm64' }}" >> "$GITHUB_OUTPUT" - echo "profile=${{ (github.event_name == 'release' || github.event_name == 'workflow_dispatch') && 'release' || 'dev' }}" >> "$GITHUB_OUTPUT" - echo "output-dir=${{ (github.event_name == 'release' || github.event_name == 'workflow_dispatch') && 'release' || 'debug' }}" >> "$GITHUB_OUTPUT" + echo "profile=${{ github.event.ref_type == 'tag' && 'release' || 'dev' }}" >> "$GITHUB_OUTPUT" + echo "output-dir=${{ github.event.ref_type == 'tag' && 'release' || 'debug' }}" >> "$GITHUB_OUTPUT" - name: Extract rust toolchain id: toolchain run: | @@ -129,6 +130,19 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: | + name=ghcr.io/${{ github.repository }} + tags: | + type=ref,event=pr,enable={{!is_default_branch}} + type=semver,pattern=v{{version}},enable={{is_default_branch}} + type=semver,pattern=v{{major}}.{{minor}},enable={{is_default_branch}} + type=semver,pattern=v{{major}},enable={{is_default_branch}} + type=raw,value=develop,enable={{is_default_branch}} + - name: Build and push to ghcr uses: docker/build-push-action@v5 with: @@ -136,4 +150,4 @@ jobs: file: Dockerfile.new platforms: linux/amd64,linux/arm64 push: true - tags: ghcr.io/vnghia/ryot:test + tags: ${{ steps.meta.outputs.tags }} From a92bbf19b3f830d3a90177f1e7fd8e8c4f66fa2a Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Sat, 10 Aug 2024 06:00:06 +0200 Subject: [PATCH 47/76] cache when not in a pull request --- .github/workflows/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index de1e023a4f..ac9c701d56 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -78,7 +78,7 @@ jobs: - uses: Swatinem/rust-cache@v2 with: key: ${{ matrix.platform.target }}-${{ steps.build.outputs.profile }} - save-if: ${{ github.ref == 'refs/heads/main' }} + save-if: ${{ github.event_name != 'pull_request' }} - name: Install cross if: ${{ matrix.platform.command == 'cross' }} From 41bde467b893479957473c78c678d4ca91f3c9df Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Sat, 10 Aug 2024 06:03:13 +0200 Subject: [PATCH 48/76] delete old files --- .github/workflows/main.yaml | 2 +- .github/workflows/release.yml | 195 ---------------------------------- Dockerfile | 48 +++------ Dockerfile.new | 52 --------- 4 files changed, 13 insertions(+), 284 deletions(-) delete mode 100644 .github/workflows/release.yml delete mode 100644 Dockerfile.new diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index ac9c701d56..1a8a5f994f 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -147,7 +147,7 @@ jobs: uses: docker/build-push-action@v5 with: context: . - file: Dockerfile.new + file: Dockerfile platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.meta.outputs.tags }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 6abdd27791..0000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,195 +0,0 @@ -name: Release - -on: - push: - tags: - - "*-?v[0-9]+*" - -env: - GHCR_REGISTRY: ghcr.io - -permissions: - contents: write - packages: write - -jobs: - create-release: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Create or update release - uses: actions/github-script@v7 - env: - TAG_NAME: ${{ github.ref_name }} - with: - script: | - const tag = process.env.TAG_NAME || github.ref_name; - const repo = context.repo; - const majorVersion = tag.match(/v(\d+)\.\d+\.\d+/)[1]; - const releaseName = `Version ${majorVersion}`; - const date = new Date().toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' }); - const dynamicBody = `\n*Created from tag*: \`${tag}\`\n*Created from git revision*: \`${context.sha}\`\n*Published on*: \`${date}\`\n`; - - async function findOrCreateRelease() { - const { data: releases } = await github.rest.repos.listReleases(repo); - let existingRelease = releases.find(release => release.name === releaseName); - - if (existingRelease) { - const existingBody = existingRelease.body; - const newBody = existingBody.replace(/[^]*/, dynamicBody); - await github.rest.repos.updateRelease({ - ...repo, - release_id: existingRelease.id, - tag_name: tag, - body: newBody, - draft: false, - }); - console.log("Release updated to associate with new tag."); - } else { - const fullBody = `${dynamicBody}\n\n## Release Notes\n\n- Some bug fixes.`; - await github.rest.repos.createRelease({ - ...repo, - tag_name: tag, - name: releaseName, - body: fullBody, - draft: false, - prerelease: false - }); - console.log("Release created successfully."); - } - } - - findOrCreateRelease(); - - docker-release: - runs-on: ubuntu-latest - needs: create-release - steps: - - uses: actions/checkout@v4 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Log in to the ghcr container registry - uses: docker/login-action@v3 - with: - registry: ${{ env.GHCR_REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Log in to the docker hub container registry - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_TOKEN }} - - - name: Get docker image names - id: required_args - uses: actions/github-script@v7 - env: - DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} - with: - script: | - const repoName = context.payload.repository.name; - const refName = context.ref.replace('refs/tags/', ''); - core.setOutput('APP_VERSION', refName); - - const dockerHubActor = process.env.DOCKER_USERNAME; - const ghcrRegistry = process.env.GHCR_REGISTRY; - const ghcrActor = context.actor; - - function generateVersionArray(version) { - const parts = version.split("."); - const versionArray = []; - for (let i = 0; i < parts.length; i++) - versionArray.push(parts.slice(0, i + 1).join(".")); - versionArray.push("latest"); - return versionArray; - } - - const versionTags = generateVersionArray(refName); - const ghcrImageName = `${ghcrRegistry}/${ghcrActor}/${repoName}`; - const ghcrTags = versionTags.map((tag) => `${ghcrImageName}:${tag}`); - - const dockerHubImageName = `${dockerHubActor}/${repoName}`; - const dockerHubTags = versionTags.map((tag) => `${dockerHubImageName}:${tag}`); - - const imageNames = [...ghcrTags, dockerHubTags].join(",").toLowerCase(); - core.setOutput('image_names', imageNames); - - - name: Build and push to ghcr - uses: docker/build-push-action@v5 - with: - context: . - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ steps.required_args.outputs.image_names }} - build-args: | - APP_VERSION=${{ steps.required_args.outputs.APP_VERSION }} - DEFAULT_TMDB_ACCESS_TOKEN=${{ secrets.DEFAULT_TMDB_ACCESS_TOKEN }} - DEFAULT_MAL_CLIENT_ID=${{ secrets.DEFAULT_MAL_CLIENT_ID }} - DEFAULT_GOOGLE_BOOKS_API_KEY=${{ secrets.DEFAULT_GOOGLE_BOOKS_API_KEY }} - - upload-kodi-plugin: - runs-on: ubuntu-20.04 - needs: docker-release - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - - uses: actions/checkout@v4 - - - name: Setup Moon - uses: moonrepo/setup-toolchain@v0 - with: - auto-install: true - - - name: Build plugin - run: moon run kodi:build - - - name: Upload plugin to releases - run: gh release upload --clobber ${{ github.ref_name }} "tmp/script.ryot.zip" - - deploy-demo-instance: - runs-on: ubuntu-latest - needs: docker-release - steps: - - uses: actions/checkout@v4 - - - name: Set up CLI - uses: superfly/flyctl-actions/setup-flyctl@master - - - name: Deploy - run: flyctl deploy --remote-only --detach --config ci/fly.toml - env: - FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} - - deploy-docs: - runs-on: ubuntu-latest - needs: docker-release - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-python@v5 - with: - python-version: 3.x - - - name: Install poetry - uses: abatilo/actions-poetry@v2 - - - name: Install dependencies - run: cd docs && poetry install - - - name: Build docs - run: cd docs && poetry run mkdocs build - - - name: Push to deployment branch - uses: peaceiris/actions-gh-pages@v4 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: docs/site - publish_branch: nf-docs - force_orphan: true diff --git a/Dockerfile b/Dockerfile index 679f77e850..218e487057 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,6 @@ ARG NODE_BASE_IMAGE=node:20.10.0-bookworm-slim -FROM --platform=$BUILDPLATFORM $NODE_BASE_IMAGE AS node-build-base - -FROM node-build-base AS frontend-build-base +FROM $NODE_BASE_IMAGE AS frontend-build-base ENV MOON_TOOLCHAIN_FORCE_GLOBALS=true WORKDIR /app RUN apt update && apt install -y --no-install-recommends git curl ca-certificates xz-utils @@ -21,53 +19,31 @@ COPY --from=frontend-workspace /app/.moon/docker/sources . RUN moon run frontend:build transactional:build RUN moon docker prune -FROM --platform=$BUILDPLATFORM lukemathwalker/cargo-chef AS backend-chef -RUN apt-get update && apt-get install -y --no-install-recommends gcc-aarch64-linux-gnu libc6-dev-arm64-cross clang llvm ca-certificates pkg-config make g++ libssl-dev -RUN update-ca-certificates -WORKDIR app - -FROM backend-chef AS backend-planner -COPY . . -RUN cargo chef prepare --recipe-path recipe.json - -FROM backend-chef AS backend-builder -# build specific -ARG BUILD_PROFILE=release -# application specific -ARG APP_VERSION -ARG DEFAULT_TMDB_ACCESS_TOKEN -ARG DEFAULT_MAL_CLIENT_ID -ARG DEFAULT_GOOGLE_BOOKS_API_KEY -RUN test -n "$APP_VERSION" && \ - test -n "$DEFAULT_TMDB_ACCESS_TOKEN" && \ - test -n "$DEFAULT_MAL_CLIENT_ID" && \ - test -n "$DEFAULT_GOOGLE_BOOKS_API_KEY" -COPY --from=backend-planner /app/recipe.json recipe.json -RUN cargo chef cook --profile $BUILD_PROFILE --recipe-path recipe.json -COPY . . -COPY --from=frontend-builder /app/apps/backend/templates ./apps/backend/templates -RUN APP_VERSION=$APP_VERSION \ - DEFAULT_TMDB_ACCESS_TOKEN=$DEFAULT_TMDB_ACCESS_TOKEN \ - DEFAULT_MAL_CLIENT_ID=$DEFAULT_MAL_CLIENT_ID \ - DEFAULT_GOOGLE_BOOKS_API_KEY=$DEFAULT_GOOGLE_BOOKS_API_KEY \ - cargo build --profile ${BUILD_PROFILE} --bin ryot -RUN cp -R /app/target/${BUILD_PROFILE}/ryot /app/ryot +FROM --platform=${BUILDPLATFORM} alpine as artifact +COPY artifact/ /artifact/ +ARG TARGETARCH +ENV TARGETARCH=${TARGETARCH} +RUN mv /artifact/backend-${TARGETARCH}/ryot /artifact/ryot +RUN chmod +x /artifact/ryot FROM $NODE_BASE_IMAGE +ARG TARGETARCH +ENV TARGETARCH=${TARGETARCH} LABEL org.opencontainers.image.source="https://github.com/IgnisDa/ryot" ENV FRONTEND_UMAMI_SCRIPT_URL="https://umami.diptesh.me/script.js" ENV FRONTEND_UMAMI_WEBSITE_ID="5ecd6915-d542-4fda-aa5f-70f09f04e2e0" COPY --from=caddy:2.7.5 /usr/bin/caddy /usr/local/bin/caddy -RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates procps && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y --no-install-recommends libssl3 ca-certificates && rm -rf /var/lib/apt/lists/* RUN npm install --global concurrently@8.2.2 && concurrently --version RUN useradd -m -u 1001 ryot +RUN if [ "${TARGETARCH}" = "arm64" ]; then apt-get update && apt-get install -y --no-install-recommends wget && wget http://ftp.debian.org/debian/pool/main/o/openssl/libssl1.1_1.1.1w-0+deb11u1_arm64.deb && dpkg -i libssl1.1_1.1.1w-0+deb11u1_arm64.deb && rm -rf libssl1.1_1.1.1w-0+deb11u1_arm64.deb && apt-get remove -y wget && rm -rf rm -rf /var/lib/apt/lists/*; fi WORKDIR /home/ryot USER ryot COPY ci/Caddyfile /etc/caddy/Caddyfile COPY --from=frontend-builder --chown=ryot:ryot /app/apps/frontend/node_modules ./node_modules COPY --from=frontend-builder --chown=ryot:ryot /app/apps/frontend/package.json ./package.json COPY --from=frontend-builder --chown=ryot:ryot /app/apps/frontend/build ./build -COPY --from=backend-builder --chown=ryot:ryot /app/ryot /usr/local/bin/ryot +COPY --from=artifact --chown=ryot:ryot /artifact/ryot /usr/local/bin/ryot CMD [ \ "concurrently", "--names", "frontend,backend,proxy", "--kill-others", \ "PORT=3000 npx remix-serve ./build/server/index.js", \ diff --git a/Dockerfile.new b/Dockerfile.new deleted file mode 100644 index 218e487057..0000000000 --- a/Dockerfile.new +++ /dev/null @@ -1,52 +0,0 @@ -ARG NODE_BASE_IMAGE=node:20.10.0-bookworm-slim - -FROM $NODE_BASE_IMAGE AS frontend-build-base -ENV MOON_TOOLCHAIN_FORCE_GLOBALS=true -WORKDIR /app -RUN apt update && apt install -y --no-install-recommends git curl ca-certificates xz-utils -RUN npm install -g @moonrepo/cli && moon --version - -FROM frontend-build-base AS frontend-workspace -WORKDIR /app -COPY . . -RUN moon docker scaffold frontend transactional - -FROM frontend-build-base AS frontend-builder -WORKDIR /app -COPY --from=frontend-workspace /app/.moon/docker/workspace . -RUN moon docker setup -COPY --from=frontend-workspace /app/.moon/docker/sources . -RUN moon run frontend:build transactional:build -RUN moon docker prune - -FROM --platform=${BUILDPLATFORM} alpine as artifact -COPY artifact/ /artifact/ -ARG TARGETARCH -ENV TARGETARCH=${TARGETARCH} -RUN mv /artifact/backend-${TARGETARCH}/ryot /artifact/ryot -RUN chmod +x /artifact/ryot - -FROM $NODE_BASE_IMAGE -ARG TARGETARCH -ENV TARGETARCH=${TARGETARCH} -LABEL org.opencontainers.image.source="https://github.com/IgnisDa/ryot" -ENV FRONTEND_UMAMI_SCRIPT_URL="https://umami.diptesh.me/script.js" -ENV FRONTEND_UMAMI_WEBSITE_ID="5ecd6915-d542-4fda-aa5f-70f09f04e2e0" -COPY --from=caddy:2.7.5 /usr/bin/caddy /usr/local/bin/caddy -RUN apt-get update && apt-get install -y --no-install-recommends libssl3 ca-certificates && rm -rf /var/lib/apt/lists/* -RUN npm install --global concurrently@8.2.2 && concurrently --version -RUN useradd -m -u 1001 ryot -RUN if [ "${TARGETARCH}" = "arm64" ]; then apt-get update && apt-get install -y --no-install-recommends wget && wget http://ftp.debian.org/debian/pool/main/o/openssl/libssl1.1_1.1.1w-0+deb11u1_arm64.deb && dpkg -i libssl1.1_1.1.1w-0+deb11u1_arm64.deb && rm -rf libssl1.1_1.1.1w-0+deb11u1_arm64.deb && apt-get remove -y wget && rm -rf rm -rf /var/lib/apt/lists/*; fi -WORKDIR /home/ryot -USER ryot -COPY ci/Caddyfile /etc/caddy/Caddyfile -COPY --from=frontend-builder --chown=ryot:ryot /app/apps/frontend/node_modules ./node_modules -COPY --from=frontend-builder --chown=ryot:ryot /app/apps/frontend/package.json ./package.json -COPY --from=frontend-builder --chown=ryot:ryot /app/apps/frontend/build ./build -COPY --from=artifact --chown=ryot:ryot /artifact/ryot /usr/local/bin/ryot -CMD [ \ - "concurrently", "--names", "frontend,backend,proxy", "--kill-others", \ - "PORT=3000 npx remix-serve ./build/server/index.js", \ - "BACKEND_PORT=5000 /usr/local/bin/ryot", \ - "caddy run --config /etc/caddy/Caddyfile" \ -] From ecce70eb200630564c81d332ba988d96b5699049 Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Sat, 10 Aug 2024 06:10:46 +0200 Subject: [PATCH 49/76] enable --- .github/workflows/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 1a8a5f994f..3bb0c82177 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -137,7 +137,7 @@ jobs: images: | name=ghcr.io/${{ github.repository }} tags: | - type=ref,event=pr,enable={{!is_default_branch}} + type=ref,event=pr type=semver,pattern=v{{version}},enable={{is_default_branch}} type=semver,pattern=v{{major}}.{{minor}},enable={{is_default_branch}} type=semver,pattern=v{{major}},enable={{is_default_branch}} From b2b26c71ad9d7065ae6afa3d6c492f10a65c590b Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Sat, 10 Aug 2024 06:40:50 +0200 Subject: [PATCH 50/76] passenv --- Cross.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cross.toml b/Cross.toml index 71d3ad73c1..d1136ace5b 100644 --- a/Cross.toml +++ b/Cross.toml @@ -3,6 +3,7 @@ passthrough = [ "APP_VERSION", "DEFAULT_TMDB_ACCESS_TOKEN", "DEFAULT_MAL_CLIENT_ID", + "DEFAULT_GOOGLE_BOOKS_API_KEY", ] [build] From fb9adc3b74ada7f24a8c3b4b6f9b3aa21e773061 Mon Sep 17 00:00:00 2001 From: Nghia Date: Sat, 10 Aug 2024 10:28:28 +0200 Subject: [PATCH 51/76] re-add the change from https://github.com/IgnisDa/ryot/pull/944 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 218e487057..3a147ba5de 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,7 +33,7 @@ LABEL org.opencontainers.image.source="https://github.com/IgnisDa/ryot" ENV FRONTEND_UMAMI_SCRIPT_URL="https://umami.diptesh.me/script.js" ENV FRONTEND_UMAMI_WEBSITE_ID="5ecd6915-d542-4fda-aa5f-70f09f04e2e0" COPY --from=caddy:2.7.5 /usr/bin/caddy /usr/local/bin/caddy -RUN apt-get update && apt-get install -y --no-install-recommends libssl3 ca-certificates && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y --no-install-recommends libssl3 ca-certificates procps && rm -rf /var/lib/apt/lists/* RUN npm install --global concurrently@8.2.2 && concurrently --version RUN useradd -m -u 1001 ryot RUN if [ "${TARGETARCH}" = "arm64" ]; then apt-get update && apt-get install -y --no-install-recommends wget && wget http://ftp.debian.org/debian/pool/main/o/openssl/libssl1.1_1.1.1w-0+deb11u1_arm64.deb && dpkg -i libssl1.1_1.1.1w-0+deb11u1_arm64.deb && rm -rf libssl1.1_1.1.1w-0+deb11u1_arm64.deb && apt-get remove -y wget && rm -rf rm -rf /var/lib/apt/lists/*; fi From 60c819bdd104be860935733be3a2c58408ea13ad Mon Sep 17 00:00:00 2001 From: Diptesh Choudhuri Date: Sat, 10 Aug 2024 19:24:43 +0530 Subject: [PATCH 52/76] ci: change name of file --- .github/workflows/{main.yaml => main.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{main.yaml => main.yml} (100%) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yml similarity index 100% rename from .github/workflows/main.yaml rename to .github/workflows/main.yml From 6481c79cb322c5f677d29e3dd9c47597173fd1a3 Mon Sep 17 00:00:00 2001 From: Diptesh Choudhuri Date: Sat, 10 Aug 2024 19:34:59 +0530 Subject: [PATCH 53/76] ci: decide whether to run workflow in PR --- .github/workflows/main.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3bb0c82177..e6823f0c59 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,6 +7,7 @@ on: - "*-?v[0-9]+*" pull_request: branches: ["main"] + types: [opened, synchronize] env: GHCR_REGISTRY: ghcr.io @@ -16,7 +17,33 @@ permissions: packages: write jobs: + check-commit-message: + runs-on: ubuntu-latest + outputs: + should-run: ${{ steps.check.outputs.should-run }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 2 + - name: Check commit message + id: check + run: | + if [[ "${{ github.event_name }}" == "push" ]]; then + echo "should-run=true" >> $GITHUB_OUTPUT + elif [[ "${{ github.event_name }}" == "pull_request" ]]; then + COMMIT_MSG=$(git log -1 --pretty=format:%s) + if [[ $COMMIT_MSG == *"Run CI"* ]]; then + echo "should-run=true" >> $GITHUB_OUTPUT + else + echo "should-run=false" >> $GITHUB_OUTPUT + fi + else + echo "should-run=false" >> $GITHUB_OUTPUT + fi + build-frontend: + needs: check-commit-message + if: needs.check-commit-message.outputs.should-run == 'true' runs-on: ubuntu-latest env: MOON_TOOLCHAIN_FORCE_GLOBALS: true @@ -39,7 +66,9 @@ jobs: build-backend: needs: + - check-commit-message - build-frontend + if: needs.check-commit-message.outputs.should-run == 'true' strategy: fail-fast: false @@ -107,7 +136,9 @@ jobs: build-docker: needs: + - check-commit-message - build-backend + if: needs.check-commit-message.outputs.should-run == 'true' runs-on: ubuntu-latest steps: From 14059ce3fffe0d7402bed24dd29a6813fe9c56fe Mon Sep 17 00:00:00 2001 From: Diptesh Choudhuri Date: Sat, 10 Aug 2024 19:36:45 +0530 Subject: [PATCH 54/76] ci: test commit Run CI. From 56332e7f56f6e60689831f7ce1db160727093209 Mon Sep 17 00:00:00 2001 From: Diptesh Choudhuri Date: Sat, 10 Aug 2024 19:38:23 +0530 Subject: [PATCH 55/76] ci: test commit Run CI. --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e6823f0c59..073a7504c3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,6 +40,7 @@ jobs: else echo "should-run=false" >> $GITHUB_OUTPUT fi + cat $GITHUB_OUTPUT build-frontend: needs: check-commit-message From c88ee15106e72d7bc3caf16976f0c37a4ebe1d79 Mon Sep 17 00:00:00 2001 From: Diptesh Choudhuri Date: Sat, 10 Aug 2024 19:39:23 +0530 Subject: [PATCH 56/76] ci: Run CI --- .github/workflows/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 073a7504c3..e6823f0c59 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,7 +40,6 @@ jobs: else echo "should-run=false" >> $GITHUB_OUTPUT fi - cat $GITHUB_OUTPUT build-frontend: needs: check-commit-message From 847a26180e62e106c6578de5ca892e8369b30d38 Mon Sep 17 00:00:00 2001 From: Diptesh Choudhuri Date: Sat, 10 Aug 2024 19:40:11 +0530 Subject: [PATCH 57/76] ci: dump contents [Run CI] --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e6823f0c59..073a7504c3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,6 +40,7 @@ jobs: else echo "should-run=false" >> $GITHUB_OUTPUT fi + cat $GITHUB_OUTPUT build-frontend: needs: check-commit-message From e1ea0c2136ef66816873d9a1a02c63a42f2838fe Mon Sep 17 00:00:00 2001 From: Diptesh Choudhuri Date: Sat, 10 Aug 2024 19:43:24 +0530 Subject: [PATCH 58/76] ci: add more logging [RUN CI] --- .github/workflows/main.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 073a7504c3..88833ef22b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -30,17 +30,22 @@ jobs: run: | if [[ "${{ github.event_name }}" == "push" ]]; then echo "should-run=true" >> $GITHUB_OUTPUT + echo "Event type is push, should-run is set to true" elif [[ "${{ github.event_name }}" == "pull_request" ]]; then COMMIT_MSG=$(git log -1 --pretty=format:%s) - if [[ $COMMIT_MSG == *"Run CI"* ]]; then + echo "Commit message: $COMMIT_MSG" + if [[ "$COMMIT_MSG" == *"Run CI"* ]]; then echo "should-run=true" >> $GITHUB_OUTPUT + echo "Commit message contains 'Run CI', should-run is set to true" else echo "should-run=false" >> $GITHUB_OUTPUT + echo "Commit message does not contain 'Run CI', should-run is set to false" fi else echo "should-run=false" >> $GITHUB_OUTPUT + echo "Event type is neither push nor pull_request, should-run is set to false" fi - cat $GITHUB_OUTPUT + echo "Final should-run value: $(cat $GITHUB_OUTPUT | grep should-run | cut -d'=' -f2)" build-frontend: needs: check-commit-message From b2db804f8cdb0f156c5bc5b21b1df7df75104db6 Mon Sep 17 00:00:00 2001 From: Diptesh Choudhuri Date: Sat, 10 Aug 2024 19:45:08 +0530 Subject: [PATCH 59/76] ci: select correct commit message [Run CI] --- .github/workflows/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 88833ef22b..11fadc6c9d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,7 +32,8 @@ jobs: echo "should-run=true" >> $GITHUB_OUTPUT echo "Event type is push, should-run is set to true" elif [[ "${{ github.event_name }}" == "pull_request" ]]; then - COMMIT_MSG=$(git log -1 --pretty=format:%s) + # Get the last commit message on the PR branch + COMMIT_MSG=$(git log --format=%B -n 1 ${{ github.event.pull_request.head.sha }}) echo "Commit message: $COMMIT_MSG" if [[ "$COMMIT_MSG" == *"Run CI"* ]]; then echo "should-run=true" >> $GITHUB_OUTPUT From d6af6a127c5578b7ebb3f36911b67ff2128db3c6 Mon Sep 17 00:00:00 2001 From: Diptesh Choudhuri Date: Sat, 10 Aug 2024 19:48:04 +0530 Subject: [PATCH 60/76] ci: remove useless comment --- .github/workflows/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 11fadc6c9d..bae3d79a93 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,7 +32,6 @@ jobs: echo "should-run=true" >> $GITHUB_OUTPUT echo "Event type is push, should-run is set to true" elif [[ "${{ github.event_name }}" == "pull_request" ]]; then - # Get the last commit message on the PR branch COMMIT_MSG=$(git log --format=%B -n 1 ${{ github.event.pull_request.head.sha }}) echo "Commit message: $COMMIT_MSG" if [[ "$COMMIT_MSG" == *"Run CI"* ]]; then From cd15292de360e1582d0a1ab5be636b172010a7fd Mon Sep 17 00:00:00 2001 From: Diptesh Choudhuri Date: Sat, 10 Aug 2024 20:04:52 +0530 Subject: [PATCH 61/76] ci: add caching to docker action --- .github/workflows/main.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bae3d79a93..d4f5457623 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -184,7 +184,8 @@ jobs: uses: docker/build-push-action@v5 with: context: . - file: Dockerfile - platforms: linux/amd64,linux/arm64 push: true + cache-from: type=gha + cache-to: type=gha,mode=max + platforms: linux/amd64,linux/arm64 tags: ${{ steps.meta.outputs.tags }} From 4c74ec5266aba464babd9a52b503f7141c3face9 Mon Sep 17 00:00:00 2001 From: Diptesh Choudhuri Date: Sat, 10 Aug 2024 20:05:18 +0530 Subject: [PATCH 62/76] ci: test whole commit message if workflow should run Run CI. --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d4f5457623..ff97d41b5e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,7 +32,7 @@ jobs: echo "should-run=true" >> $GITHUB_OUTPUT echo "Event type is push, should-run is set to true" elif [[ "${{ github.event_name }}" == "pull_request" ]]; then - COMMIT_MSG=$(git log --format=%B -n 1 ${{ github.event.pull_request.head.sha }}) + COMMIT_MSG=$(git log --format=%B ${{ github.event.pull_request.head.sha }}) echo "Commit message: $COMMIT_MSG" if [[ "$COMMIT_MSG" == *"Run CI"* ]]; then echo "should-run=true" >> $GITHUB_OUTPUT From c471fd5afac53994d02933440f490933e36ed2f5 Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Sat, 10 Aug 2024 18:04:13 +0200 Subject: [PATCH 63/76] also push to docker hub --- .github/workflows/main.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ff97d41b5e..b4566e4833 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -167,12 +167,19 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Log in to the docker hub container registry + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + - name: Extract metadata for Docker id: meta uses: docker/metadata-action@v5 with: images: | - name=ghcr.io/${{ github.repository }} + name=${{ secrets.DOCKER_USERNAME }}/${{ github.repository.name }} + name=${{ env.GHCR_REGISTRY }}/${{ github.actor }}/${{ github.repository.name }} tags: | type=ref,event=pr type=semver,pattern=v{{version}},enable={{is_default_branch}} @@ -180,7 +187,7 @@ jobs: type=semver,pattern=v{{major}},enable={{is_default_branch}} type=raw,value=develop,enable={{is_default_branch}} - - name: Build and push to ghcr + - name: Build and push uses: docker/build-push-action@v5 with: context: . From 226511fa395ec92f2ead039fd2e20074d306d0be Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Sat, 10 Aug 2024 18:07:23 +0200 Subject: [PATCH 64/76] typo [Run CI] --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b4566e4833..9677c49afc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -178,8 +178,8 @@ jobs: uses: docker/metadata-action@v5 with: images: | - name=${{ secrets.DOCKER_USERNAME }}/${{ github.repository.name }} - name=${{ env.GHCR_REGISTRY }}/${{ github.actor }}/${{ github.repository.name }} + name=${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }} + name=${{ env.GHCR_REGISTRY }}/${{ github.actor }}/${{ github.event.repository.name }} tags: | type=ref,event=pr type=semver,pattern=v{{version}},enable={{is_default_branch}} From 7ac5c6a9a580050b9aa905574254f295626c24f6 Mon Sep 17 00:00:00 2001 From: Diptesh Choudhuri Date: Sat, 10 Aug 2024 22:28:27 +0530 Subject: [PATCH 65/76] ci: enable dockerhub only for main releases --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9677c49afc..3fb4e62c71 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -178,8 +178,8 @@ jobs: uses: docker/metadata-action@v5 with: images: | - name=${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }} name=${{ env.GHCR_REGISTRY }}/${{ github.actor }}/${{ github.event.repository.name }} + name=${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }},enable={{is_default_branch}} tags: | type=ref,event=pr type=semver,pattern=v{{version}},enable={{is_default_branch}} From acfd10219431951cee04a51a3a3ba2cae990a020 Mon Sep 17 00:00:00 2001 From: Diptesh Choudhuri Date: Sat, 10 Aug 2024 22:38:30 +0530 Subject: [PATCH 66/76] ci: remove useless echo statements [Run CI] --- .github/workflows/main.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3fb4e62c71..1bb25f1326 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -30,22 +30,16 @@ jobs: run: | if [[ "${{ github.event_name }}" == "push" ]]; then echo "should-run=true" >> $GITHUB_OUTPUT - echo "Event type is push, should-run is set to true" elif [[ "${{ github.event_name }}" == "pull_request" ]]; then COMMIT_MSG=$(git log --format=%B ${{ github.event.pull_request.head.sha }}) - echo "Commit message: $COMMIT_MSG" if [[ "$COMMIT_MSG" == *"Run CI"* ]]; then echo "should-run=true" >> $GITHUB_OUTPUT - echo "Commit message contains 'Run CI', should-run is set to true" else echo "should-run=false" >> $GITHUB_OUTPUT - echo "Commit message does not contain 'Run CI', should-run is set to false" fi else echo "should-run=false" >> $GITHUB_OUTPUT - echo "Event type is neither push nor pull_request, should-run is set to false" fi - echo "Final should-run value: $(cat $GITHUB_OUTPUT | grep should-run | cut -d'=' -f2)" build-frontend: needs: check-commit-message From 4a6f23734355974460317a2f13e44abcb8cf10e4 Mon Sep 17 00:00:00 2001 From: Vo Van Nghia Date: Sat, 10 Aug 2024 19:07:48 +0200 Subject: [PATCH 67/76] use repository_owner [Run CI] --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1bb25f1326..2337d71166 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -158,7 +158,7 @@ jobs: uses: docker/login-action@v3 with: registry: ${{ env.GHCR_REGISTRY }} - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Log in to the docker hub container registry @@ -172,8 +172,8 @@ jobs: uses: docker/metadata-action@v5 with: images: | - name=${{ env.GHCR_REGISTRY }}/${{ github.actor }}/${{ github.event.repository.name }} name=${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }},enable={{is_default_branch}} + name=${{ env.GHCR_REGISTRY }}/${{ github.repository_owner }}/${{ github.event.repository.name }} tags: | type=ref,event=pr type=semver,pattern=v{{version}},enable={{is_default_branch}} From 07ca7e551eacf4f625e25ca80a24509d615e105a Mon Sep 17 00:00:00 2001 From: Diptesh Choudhuri Date: Sat, 10 Aug 2024 22:41:20 +0530 Subject: [PATCH 68/76] ci: setup caching for building frontend --- .github/workflows/main.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2337d71166..1e1dfeacf6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -53,6 +53,11 @@ jobs: - uses: moonrepo/setup-toolchain@v0 with: auto-install: true + - name: Set up Node.js and caching + uses: actions/setup-node@v3 + with: + node-version: '20' + cache: 'yarn' - name: Build frontend run: | moon run frontend:build transactional:build From 883eb0e53bfae3dc5a7a4e136ebac2a5174f4bca Mon Sep 17 00:00:00 2001 From: Diptesh Choudhuri Date: Sat, 10 Aug 2024 22:42:46 +0530 Subject: [PATCH 69/76] ci: build only in release mode [Run CI] --- .github/workflows/main.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1e1dfeacf6..ec0ff7ca4e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -99,8 +99,6 @@ jobs: run: | echo "version=${GITHUB_REF##*/}" >> "$GITHUB_OUTPUT" echo "docker-arch=${{ startsWith(matrix.platform.target, 'x86_64') && 'amd64' || 'arm64' }}" >> "$GITHUB_OUTPUT" - echo "profile=${{ github.event.ref_type == 'tag' && 'release' || 'dev' }}" >> "$GITHUB_OUTPUT" - echo "output-dir=${{ github.event.ref_type == 'tag' && 'release' || 'debug' }}" >> "$GITHUB_OUTPUT" - name: Extract rust toolchain id: toolchain run: | @@ -113,7 +111,6 @@ jobs: with: key: ${{ matrix.platform.target }}-${{ steps.build.outputs.profile }} save-if: ${{ github.event_name != 'pull_request' }} - - name: Install cross if: ${{ matrix.platform.command == 'cross' }} uses: taiki-e/cache-cargo-install-action@v2 @@ -130,13 +127,12 @@ jobs: DEFAULT_MAL_CLIENT_ID: ${{ secrets.DEFAULT_MAL_CLIENT_ID }} DEFAULT_GOOGLE_BOOKS_API_KEY: ${{ secrets.DEFAULT_GOOGLE_BOOKS_API_KEY }} run: | - touch .env - ${{ matrix.platform.command }} build --locked --target ${{ matrix.platform.target }} --profile ${{ steps.build.outputs.profile }} + ${{ matrix.platform.command }} build --locked --target ${{ matrix.platform.target }} --release - name: Upload build artifact uses: actions/upload-artifact@v4 with: name: backend-${{ steps.build.outputs.docker-arch }} - path: ${{ github.workspace }}/target/${{ matrix.platform.target }}/${{ steps.build.outputs.output-dir }}/ryot + path: ${{ github.workspace }}/target/${{ matrix.platform.target }}/release/ryot retention-days: 1 build-docker: From 883f1fa7d64cd05081c9a0e2278da6d21a11ff6f Mon Sep 17 00:00:00 2001 From: Diptesh Choudhuri Date: Sun, 11 Aug 2024 09:40:22 +0530 Subject: [PATCH 70/76] ci: add new steps --- .github/workflows/main.yml | 77 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ec0ff7ca4e..b1889a80ab 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,6 +21,7 @@ jobs: runs-on: ubuntu-latest outputs: should-run: ${{ steps.check.outputs.should-run }} + is-release: ${{ steps.tag.outputs.is-release }} steps: - uses: actions/checkout@v4 with: @@ -40,6 +41,14 @@ jobs: else echo "should-run=false" >> $GITHUB_OUTPUT fi + - name: Check tag + id: tag + run: | + if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/tags/${{ github.ref_name }}" ]]; then + echo "is-release=true" >> $GITHUB_OUTPUT + else + echo "is-release=false" >> $GITHUB_OUTPUT + fi build-frontend: needs: check-commit-message @@ -191,3 +200,71 @@ jobs: cache-to: type=gha,mode=max platforms: linux/amd64,linux/arm64 tags: ${{ steps.meta.outputs.tags }} + + upload-kodi-plugin: + needs: + - check-commit-message + - build-docker + if: needs.check-commit-message.outputs.is-release == 'true' + runs-on: ubuntu-20.04 + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + MOON_TOOLCHAIN_FORCE_GLOBALS: true + + steps: + - uses: actions/checkout@v4 + - name: Setup Moon + uses: moonrepo/setup-toolchain@v0 + with: + auto-install: true + - name: Set up Node.js and caching + uses: actions/setup-node@v3 + with: + node-version: '20' + cache: 'yarn' + - name: Build plugin + run: moon run kodi:build + - name: Upload plugin to releases + run: gh release upload --clobber ${{ github.ref_name }} "tmp/script.ryot.zip" + + deploy-demo-instance: + needs: + - check-commit-message + - build-docker + if: needs.check-commit-message.outputs.is-release == 'true' + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up CLI + uses: superfly/flyctl-actions/setup-flyctl@master + - name: Deploy + run: flyctl deploy --remote-only --detach --config ci/fly.toml + env: + FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} + + deploy-docs: + needs: + - check-commit-message + - build-docker + if: needs.check-commit-message.outputs.is-release == 'true' + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.x + - name: Install poetry + uses: abatilo/actions-poetry@v2 + - name: Install dependencies + run: cd docs && poetry install + - name: Build docs + run: cd docs && poetry run mkdocs build + - name: Push to deployment branch + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: docs/site + publish_branch: nf-docs + force_orphan: true From e931a4b9d29c4590db1da0f40b4d50824d5465e7 Mon Sep 17 00:00:00 2001 From: Diptesh Choudhuri Date: Sun, 11 Aug 2024 09:40:51 +0530 Subject: [PATCH 71/76] ci: change name of job [Run CI] --- .github/workflows/main.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b1889a80ab..d63212e86b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,7 +17,7 @@ permissions: packages: write jobs: - check-commit-message: + pre-workflow-checks: runs-on: ubuntu-latest outputs: should-run: ${{ steps.check.outputs.should-run }} @@ -51,8 +51,8 @@ jobs: fi build-frontend: - needs: check-commit-message - if: needs.check-commit-message.outputs.should-run == 'true' + needs: pre-workflow-checks + if: needs.pre-workflow-checks.outputs.should-run == 'true' runs-on: ubuntu-latest env: MOON_TOOLCHAIN_FORCE_GLOBALS: true @@ -80,9 +80,9 @@ jobs: build-backend: needs: - - check-commit-message + - pre-workflow-checks - build-frontend - if: needs.check-commit-message.outputs.should-run == 'true' + if: needs.pre-workflow-checks.outputs.should-run == 'true' strategy: fail-fast: false @@ -146,9 +146,9 @@ jobs: build-docker: needs: - - check-commit-message + - pre-workflow-checks - build-backend - if: needs.check-commit-message.outputs.should-run == 'true' + if: needs.pre-workflow-checks.outputs.should-run == 'true' runs-on: ubuntu-latest steps: @@ -203,9 +203,9 @@ jobs: upload-kodi-plugin: needs: - - check-commit-message + - pre-workflow-checks - build-docker - if: needs.check-commit-message.outputs.is-release == 'true' + if: needs.pre-workflow-checks.outputs.is-release == 'true' runs-on: ubuntu-20.04 env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -229,9 +229,9 @@ jobs: deploy-demo-instance: needs: - - check-commit-message + - pre-workflow-checks - build-docker - if: needs.check-commit-message.outputs.is-release == 'true' + if: needs.pre-workflow-checks.outputs.is-release == 'true' runs-on: ubuntu-latest steps: @@ -245,9 +245,9 @@ jobs: deploy-docs: needs: - - check-commit-message + - pre-workflow-checks - build-docker - if: needs.check-commit-message.outputs.is-release == 'true' + if: needs.pre-workflow-checks.outputs.is-release == 'true' runs-on: ubuntu-latest steps: From ebc89747a35fd5472466167874f21947506f7c18 Mon Sep 17 00:00:00 2001 From: Diptesh Choudhuri Date: Sun, 11 Aug 2024 09:46:05 +0530 Subject: [PATCH 72/76] ci: change name of output --- .github/workflows/main.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d63212e86b..df9063093d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest outputs: should-run: ${{ steps.check.outputs.should-run }} - is-release: ${{ steps.tag.outputs.is-release }} + should-release: ${{ steps.tag.outputs.should-release }} steps: - uses: actions/checkout@v4 with: @@ -45,9 +45,9 @@ jobs: id: tag run: | if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/tags/${{ github.ref_name }}" ]]; then - echo "is-release=true" >> $GITHUB_OUTPUT + echo "should-release=true" >> $GITHUB_OUTPUT else - echo "is-release=false" >> $GITHUB_OUTPUT + echo "should-release=false" >> $GITHUB_OUTPUT fi build-frontend: @@ -205,7 +205,7 @@ jobs: needs: - pre-workflow-checks - build-docker - if: needs.pre-workflow-checks.outputs.is-release == 'true' + if: needs.pre-workflow-checks.outputs.should-release == 'true' runs-on: ubuntu-20.04 env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -231,7 +231,7 @@ jobs: needs: - pre-workflow-checks - build-docker - if: needs.pre-workflow-checks.outputs.is-release == 'true' + if: needs.pre-workflow-checks.outputs.should-release == 'true' runs-on: ubuntu-latest steps: @@ -247,7 +247,7 @@ jobs: needs: - pre-workflow-checks - build-docker - if: needs.pre-workflow-checks.outputs.is-release == 'true' + if: needs.pre-workflow-checks.outputs.should-release == 'true' runs-on: ubuntu-latest steps: From 6d6055e6ea73b6b0e59c58f4e8d4dc7e36fb417f Mon Sep 17 00:00:00 2001 From: Diptesh Choudhuri Date: Sun, 11 Aug 2024 10:34:38 +0530 Subject: [PATCH 73/76] ci: add step to create release --- .github/workflows/main.yml | 39 ++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index df9063093d..c2e9b18d61 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,6 +22,7 @@ jobs: outputs: should-run: ${{ steps.check.outputs.should-run }} should-release: ${{ steps.tag.outputs.should-release }} + steps: - uses: actions/checkout@v4 with: @@ -50,6 +51,32 @@ jobs: echo "should-release=false" >> $GITHUB_OUTPUT fi + create-release: + needs: + - pre-workflow-checks + if: needs.pre-workflow-checks.outputs.should-release == 'true' + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Generate changelog + id: changelog + uses: metcalfc/changelog-generator@v4.1.0 + with: + myToken: ${{ secrets.GITHUB_TOKEN }} + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + body: | + ## What's Changed + ${{ steps.changelog.outputs.changelog }} + draft: false + prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + build-frontend: needs: pre-workflow-checks if: needs.pre-workflow-checks.outputs.should-run == 'true' @@ -83,6 +110,7 @@ jobs: - pre-workflow-checks - build-frontend if: needs.pre-workflow-checks.outputs.should-run == 'true' + runs-on: ubuntu-latest strategy: fail-fast: false @@ -93,8 +121,6 @@ jobs: - target: aarch64-unknown-linux-gnu command: cross - runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 @@ -128,7 +154,6 @@ jobs: git: https://github.com/cross-rs/cross rev: 19be83481fd3e50ea103d800d72e0f8eddb1c90c locked: false - - name: Build env: APP_VERSION: ${{ steps.build.outputs.version }} @@ -149,34 +174,29 @@ jobs: - pre-workflow-checks - build-backend if: needs.pre-workflow-checks.outputs.should-run == 'true' - runs-on: ubuntu-latest + steps: - uses: actions/checkout@v4 - name: Download build artifact for docker uses: actions/download-artifact@v4 with: path: ${{ github.workspace }}/artifact/ - - name: Set up QEMU uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Log in to the ghcr container registry uses: docker/login-action@v3 with: registry: ${{ env.GHCR_REGISTRY }} username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Log in to the docker hub container registry uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_TOKEN }} - - name: Extract metadata for Docker id: meta uses: docker/metadata-action@v5 @@ -190,7 +210,6 @@ jobs: type=semver,pattern=v{{major}}.{{minor}},enable={{is_default_branch}} type=semver,pattern=v{{major}},enable={{is_default_branch}} type=raw,value=develop,enable={{is_default_branch}} - - name: Build and push uses: docker/build-push-action@v5 with: From a1a018b967837c102bbf52ea3d830fbe38b4a085 Mon Sep 17 00:00:00 2001 From: Diptesh Choudhuri Date: Sun, 11 Aug 2024 10:37:49 +0530 Subject: [PATCH 74/76] ci: do not build frontend in gh action --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c2e9b18d61..175d29a46e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -77,7 +77,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - build-frontend: + build-transactional: needs: pre-workflow-checks if: needs.pre-workflow-checks.outputs.should-run == 'true' runs-on: ubuntu-latest @@ -96,7 +96,7 @@ jobs: cache: 'yarn' - name: Build frontend run: | - moon run frontend:build transactional:build + moon run transactional:build - name: Upload templates artifact uses: actions/upload-artifact@v4 with: @@ -108,7 +108,7 @@ jobs: build-backend: needs: - pre-workflow-checks - - build-frontend + - build-transactional if: needs.pre-workflow-checks.outputs.should-run == 'true' runs-on: ubuntu-latest From 6dc79e1785f62ad1ed32ab903c46cf1ef4379ab6 Mon Sep 17 00:00:00 2001 From: Diptesh Choudhuri Date: Sun, 11 Aug 2024 10:38:20 +0530 Subject: [PATCH 75/76] ci: do not build transactional in dockerfile [Run CI] --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3a147ba5de..03d71c1196 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,14 +9,14 @@ RUN npm install -g @moonrepo/cli && moon --version FROM frontend-build-base AS frontend-workspace WORKDIR /app COPY . . -RUN moon docker scaffold frontend transactional +RUN moon docker scaffold frontend FROM frontend-build-base AS frontend-builder WORKDIR /app COPY --from=frontend-workspace /app/.moon/docker/workspace . RUN moon docker setup COPY --from=frontend-workspace /app/.moon/docker/sources . -RUN moon run frontend:build transactional:build +RUN moon run frontend:build RUN moon docker prune FROM --platform=${BUILDPLATFORM} alpine as artifact From 8c9bd19bda9f601bf250a46aa09b3e33a41190cf Mon Sep 17 00:00:00 2001 From: Diptesh Choudhuri Date: Sun, 11 Aug 2024 10:40:08 +0530 Subject: [PATCH 76/76] ci: change name of step --- .github/workflows/main.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 175d29a46e..ec24ae0c33 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -94,9 +94,8 @@ jobs: with: node-version: '20' cache: 'yarn' - - name: Build frontend - run: | - moon run transactional:build + - name: Build emails + run: moon run transactional:build - name: Upload templates artifact uses: actions/upload-artifact@v4 with: