From f165df045d56df4f75cf2296ef43d0fb8c624c60 Mon Sep 17 00:00:00 2001 From: Nazarii Date: Sat, 30 Aug 2025 10:08:58 +0300 Subject: [PATCH 1/2] Fix release GitHub Action --- .github/workflows/release.yml | 5 +++++ web/pyproject.toml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a15cb21..6d8b26b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,6 +33,9 @@ jobs: uses: docker/metadata-action@v5 with: images: ${{ env.DOCKER_REPOSITORY }} + tags: | + type=ref,event=tag + type=raw,value=latest - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Build and push @@ -60,6 +63,8 @@ jobs: uses: docker/metadata-action@v5 with: images: ${{ env.DOCKER_REPOSITORY }} + tags: | + type=ref,event=tag - name: deploy run: | echo "Tags: $DOCKER_REPOSITORY:$DOCKER_METADATA_OUTPUT_VERSION" diff --git a/web/pyproject.toml b/web/pyproject.toml index 4c42e54..76dbebb 100644 --- a/web/pyproject.toml +++ b/web/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "Django Template" -version = "2.0.0" +version = "2.0.2" description = "Django template with REST API, JWT authentication, Celery, Redis, and PostgreSQL" license = "MIT" authors = ["Nazarii "] From 4353cc18590d33ef6eacea77baf7806590604b40 Mon Sep 17 00:00:00 2001 From: Nazarii Date: Sat, 30 Aug 2025 10:10:29 +0300 Subject: [PATCH 2/2] Fix release GitHub Action --- .github/workflows/release.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6d8b26b..bb0bff4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,11 +11,11 @@ on: env: DOCKER_REPOSITORY: "bandirom/django-template" - jobs: tests: uses: ./.github/workflows/tests.yml secrets: inherit + build: name: "Release" runs-on: ubuntu-latest @@ -23,11 +23,13 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@v4 + - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v5 @@ -36,16 +38,19 @@ jobs: tags: | type=ref,event=tag type=raw,value=latest + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Build and push uses: docker/build-push-action@v5 with: context: . file: docker/prod/web/Dockerfile - push: ${{ github.event_name != 'pull_request' }} + push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + deploy: name: "Deploy" runs-on: ubuntu-latest @@ -53,11 +58,13 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@v4 + - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v5 @@ -65,7 +72,8 @@ jobs: images: ${{ env.DOCKER_REPOSITORY }} tags: | type=ref,event=tag - - name: deploy + + - name: Deploy run: | - echo "Tags: $DOCKER_REPOSITORY:$DOCKER_METADATA_OUTPUT_VERSION" - docker pull "$DOCKER_REPOSITORY:$DOCKER_METADATA_OUTPUT_VERSION" + echo "Deploying image: $DOCKER_REPOSITORY:${{ steps.meta.outputs.version }}" + docker pull "$DOCKER_REPOSITORY:${{ steps.meta.outputs.version }}"