Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,56 +11,69 @@ on:
env:
DOCKER_REPOSITORY: "bandirom/django-template"


jobs:
tests:
uses: ./.github/workflows/tests.yml
secrets: inherit

build:
name: "Release"
runs-on: ubuntu-latest
needs: [tests]
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
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
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
needs: [ build ]
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
with:
images: ${{ env.DOCKER_REPOSITORY }}
- name: deploy
tags: |
type=ref,event=tag

- 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 }}"
2 changes: 1 addition & 1 deletion web/pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <bandirom@ukr.net>"]
Expand Down