From 5335198479c883faab06fa8063b37ca04cee2570 Mon Sep 17 00:00:00 2001 From: Pavel Kirilin Date: Tue, 21 Jan 2025 11:54:15 +0100 Subject: [PATCH] Updated release workflow, changed docker registry. --- .github/workflows/docker.yml | 29 ------------------------- .github/workflows/release.yml | 40 +++++++++++++++++++++++++++++------ pyproject.toml | 2 +- 3 files changed, 35 insertions(+), 36 deletions(-) delete mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml deleted file mode 100644 index d0b20be3..00000000 --- a/.github/workflows/docker.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Release docker image - -on: - push: - tags: - - "*" - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Get current tag - id: tag - uses: dawidd6/action-get-tag@v1 - - name: Build and push - uses: docker/build-push-action@v2 - with: - context: . - push: true - cache-from: s3rius/fastapi_template:latest - tags: | - s3rius/fastapi_template:latest - s3rius/fastapi_template:${{steps.tag.outputs.tag}} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 26a18c28..babe1fac 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,12 +1,12 @@ name: Release python package on: - push: - tags: - - "*" + release: + types: + - released jobs: - deploy: + pypi: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -15,10 +15,38 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: "3.9" + python-version: "3.11" - name: Install deps run: poetry install + - name: Set version + run: poetry version "${{ github.ref_name }}" - name: Release package env: POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} - run: poetry publish --build \ No newline at end of file + run: poetry publish --build + docker: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Docker + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + platforms: linux/amd64 + push: true + tags: ghcr.io/s3rius/fastapi_template:latest,ghcr.io/s3rius/fastapi_template:${{ github.ref_name }} diff --git a/pyproject.toml b/pyproject.toml index cfbfaf08..faee4ffd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "fastapi_template" -version = "5.1.2" +version = "0.0.0" description = "Feature-rich robust FastAPI template" authors = ["Pavel Kirilin "] packages = [{ include = "fastapi_template" }]