From 5073cff5dc9e858a0ffe6bdeed5f15eedab75a79 Mon Sep 17 00:00:00 2001 From: codex Date: Wed, 18 Nov 2026 05:18:06 +0000 Subject: [PATCH 1/4] ci: verify application and publish container images --- .gitea/workflows/ci.yml | 78 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 .gitea/workflows/ci.yml diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..6f911cc --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,78 @@ +name: CI + +on: + pull_request: + branches: [main] + push: + branches: [main] + +jobs: + verify: + runs-on: ubuntu-latest + container: node:20-bookworm + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Install dependencies and build + run: | + corepack enable + pnpm install --frozen-lockfile + pnpm --filter @family-wishlist/backend prisma:generate + pnpm build + + images: + if: github.server_url == 'https://git.vakanaut.ru' + needs: verify + runs-on: home-build + strategy: + matrix: + include: + - component: backend + dockerfile: docker/backend.Dockerfile + - component: frontend + dockerfile: docker/frontend.Dockerfile + env: + REGISTRY: git.vakanaut.ru + COMPONENT: ${{ matrix.component }} + DOCKERFILE: ${{ matrix.dockerfile }} + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Check Docker image build + if: github.event_name == 'pull_request' + shell: bash + run: docker buildx build --file "$DOCKERFILE" --load . + + - name: Publish Docker image and record its digest + if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'admin/family_wishlist' + shell: bash + env: + REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }} + REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }} + REGISTRY_OWNER: ${{ vars.REGISTRY_OWNER }} + run: | + set -euo pipefail + : "${REGISTRY_USERNAME:?set REGISTRY_USERNAME}" + : "${REGISTRY_TOKEN:?set REGISTRY_TOKEN}" + owner="${REGISTRY_OWNER:-$REGISTRY_USERNAME}" + [[ "$owner" =~ ^[a-z0-9][a-z0-9_-]*$ ]] + + export DOCKER_CONFIG + DOCKER_CONFIG="$(mktemp -d)" + metadata="$(mktemp)" + trap 'rm -rf -- "$DOCKER_CONFIG"; rm -f -- "$metadata"' EXIT + + image="$REGISTRY/$owner/family-wishlist-$COMPONENT" + printf '%s\n' "$REGISTRY_TOKEN" | docker login "$REGISTRY" --username "$REGISTRY_USERNAME" --password-stdin + docker buildx build --file "$DOCKERFILE" --tag "$image:$GITHUB_SHA" \ + --label "org.opencontainers.image.revision=$GITHUB_SHA" \ + --label "org.opencontainers.image.source=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" \ + --metadata-file "$metadata" --push . + + digest="$(jq -er '."containerimage.digest" | select(test("^sha256:[a-f0-9]{64}$"))' "$metadata")" + printf '%s\n' "$image@$digest" + if [[ -n "${GITHUB_STEP_SUMMARY:-}" ]]; then + printf '%s\n' "$image@$digest" >> "$GITHUB_STEP_SUMMARY" + fi -- 2.54.0 From 5c68e670f303839f528b3208ca6b4470bfa4b234 Mon Sep 17 00:00:00 2001 From: codex Date: Wed, 18 Nov 2026 05:21:32 +0000 Subject: [PATCH 2/4] ci: restrict image publication to upstream main --- .gitea/workflows/ci.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 6f911cc..6f99653 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -22,9 +22,9 @@ jobs: pnpm build images: - if: github.server_url == 'https://git.vakanaut.ru' + if: github.server_url == 'https://git.vakanaut.ru' && github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'admin/family_wishlist' needs: verify - runs-on: home-build + runs-on: home-publish strategy: matrix: include: @@ -40,13 +40,7 @@ jobs: - uses: actions/checkout@v4 with: persist-credentials: false - - name: Check Docker image build - if: github.event_name == 'pull_request' - shell: bash - run: docker buildx build --file "$DOCKERFILE" --load . - - name: Publish Docker image and record its digest - if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'admin/family_wishlist' shell: bash env: REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }} -- 2.54.0 From 9fa900a14023d12ca4a2ceb2058a536517fab023 Mon Sep 17 00:00:00 2001 From: codex Date: Tue, 24 Nov 2026 21:44:29 +0000 Subject: [PATCH 3/4] ci: validate final PR head before merge to main --- .gitea/workflows/ci.yml | 55 ++---------------------------------- .gitea/workflows/publish.yml | 55 ++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 52 deletions(-) create mode 100644 .gitea/workflows/publish.yml diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 6f99653..03e7a29 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -3,11 +3,12 @@ name: CI on: pull_request: branches: [main] - push: - branches: [main] + types: [edited] jobs: verify: + if: >- + contains(github.event.pull_request.body, format('CI-Head: {0}', github.event.pull_request.head.sha)) runs-on: ubuntu-latest container: node:20-bookworm steps: @@ -20,53 +21,3 @@ jobs: pnpm install --frozen-lockfile pnpm --filter @family-wishlist/backend prisma:generate pnpm build - - images: - if: github.server_url == 'https://git.vakanaut.ru' && github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'admin/family_wishlist' - needs: verify - runs-on: home-publish - strategy: - matrix: - include: - - component: backend - dockerfile: docker/backend.Dockerfile - - component: frontend - dockerfile: docker/frontend.Dockerfile - env: - REGISTRY: git.vakanaut.ru - COMPONENT: ${{ matrix.component }} - DOCKERFILE: ${{ matrix.dockerfile }} - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Publish Docker image and record its digest - shell: bash - env: - REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }} - REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }} - REGISTRY_OWNER: ${{ vars.REGISTRY_OWNER }} - run: | - set -euo pipefail - : "${REGISTRY_USERNAME:?set REGISTRY_USERNAME}" - : "${REGISTRY_TOKEN:?set REGISTRY_TOKEN}" - owner="${REGISTRY_OWNER:-$REGISTRY_USERNAME}" - [[ "$owner" =~ ^[a-z0-9][a-z0-9_-]*$ ]] - - export DOCKER_CONFIG - DOCKER_CONFIG="$(mktemp -d)" - metadata="$(mktemp)" - trap 'rm -rf -- "$DOCKER_CONFIG"; rm -f -- "$metadata"' EXIT - - image="$REGISTRY/$owner/family-wishlist-$COMPONENT" - printf '%s\n' "$REGISTRY_TOKEN" | docker login "$REGISTRY" --username "$REGISTRY_USERNAME" --password-stdin - docker buildx build --file "$DOCKERFILE" --tag "$image:$GITHUB_SHA" \ - --label "org.opencontainers.image.revision=$GITHUB_SHA" \ - --label "org.opencontainers.image.source=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" \ - --metadata-file "$metadata" --push . - - digest="$(jq -er '."containerimage.digest" | select(test("^sha256:[a-f0-9]{64}$"))' "$metadata")" - printf '%s\n' "$image@$digest" - if [[ -n "${GITHUB_STEP_SUMMARY:-}" ]]; then - printf '%s\n' "$image@$digest" >> "$GITHUB_STEP_SUMMARY" - fi diff --git a/.gitea/workflows/publish.yml b/.gitea/workflows/publish.yml new file mode 100644 index 0000000..79e0763 --- /dev/null +++ b/.gitea/workflows/publish.yml @@ -0,0 +1,55 @@ +name: Publish images + +on: + push: + branches: [main] + +jobs: + images: + if: github.server_url == 'https://git.vakanaut.ru' && github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'admin/family_wishlist' + runs-on: home-publish + strategy: + matrix: + include: + - component: backend + dockerfile: docker/backend.Dockerfile + - component: frontend + dockerfile: docker/frontend.Dockerfile + env: + REGISTRY: git.vakanaut.ru + COMPONENT: ${{ matrix.component }} + DOCKERFILE: ${{ matrix.dockerfile }} + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Publish Docker image and record its digest + shell: bash + env: + REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }} + REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }} + REGISTRY_OWNER: ${{ vars.REGISTRY_OWNER }} + run: | + set -euo pipefail + : "${REGISTRY_USERNAME:?set REGISTRY_USERNAME}" + : "${REGISTRY_TOKEN:?set REGISTRY_TOKEN}" + owner="${REGISTRY_OWNER:-$REGISTRY_USERNAME}" + [[ "$owner" =~ ^[a-z0-9][a-z0-9_-]*$ ]] + + export DOCKER_CONFIG + DOCKER_CONFIG="$(mktemp -d)" + metadata="$(mktemp)" + trap 'rm -rf -- "$DOCKER_CONFIG"; rm -f -- "$metadata"' EXIT + + image="$REGISTRY/$owner/family-wishlist-$COMPONENT" + printf '%s\n' "$REGISTRY_TOKEN" | docker login "$REGISTRY" --username "$REGISTRY_USERNAME" --password-stdin + docker buildx build --file "$DOCKERFILE" --tag "$image:$GITHUB_SHA" \ + --label "org.opencontainers.image.revision=$GITHUB_SHA" \ + --label "org.opencontainers.image.source=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" \ + --metadata-file "$metadata" --push . + + digest="$(jq -er '."containerimage.digest" | select(test("^sha256:[a-f0-9]{64}$"))' "$metadata")" + printf '%s\n' "$image@$digest" + if [[ -n "${GITHUB_STEP_SUMMARY:-}" ]]; then + printf '%s\n' "$image@$digest" >> "$GITHUB_STEP_SUMMARY" + fi -- 2.54.0 From bb18ca350e02ae280085611601deec84058e43e6 Mon Sep 17 00:00:00 2001 From: codex Date: Sat, 28 Nov 2026 12:28:32 +0000 Subject: [PATCH 4/4] docs: record pre-merge CI and image publishing --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6397838..0185eb1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Unreleased + +- CI builds the final pull request commit before merge. A separate workflow publishes backend and frontend images after merge to main. + ## 0.6.0 - Both signed-in users can rename, update the description of, and delete shared folders. Deleting a folder preserves its wishes and their other assignments. -- 2.54.0