From dce678ca95fa4a177a03298115efe6ed93e7d672 Mon Sep 17 00:00:00 2001 From: chenweijia Date: Thu, 15 Aug 2024 17:03:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=94=B9gitea=20action?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=89=88=E6=9C=AC=E5=8F=B7=E7=9A=84=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/build_app.yaml | 12 ++---------- .gitea/workflows/build_runtime.yaml | 13 ++----------- main.py | 1 - pyproject.toml | 4 ++-- 4 files changed, 6 insertions(+), 24 deletions(-) diff --git a/.gitea/workflows/build_app.yaml b/.gitea/workflows/build_app.yaml index 4633c53..de673b5 100644 --- a/.gitea/workflows/build_app.yaml +++ b/.gitea/workflows/build_app.yaml @@ -27,16 +27,8 @@ jobs: - run: | var=${{ gitea.repository }} repo=${var##*/} - url="https://hub.airpig.cn/api/v2.0/projects/library/repositories/${repo}/artifacts?page=1&page_size=10&with_tag=true&with_label=false&with_scan_overview=false&with_signature=false&with_immutable_status=false&with_accessory=false" - version=$(curl -X 'GET' $url \ - -H 'accept: application/json' \ - -H 'X-Accept-Vulnerabilities: application/vnd.security.vulnerability.report; version=1.1, application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0' \ - -u 'admin:Chenweijia!' | jq '.[0].tags[0].name') - if [ ! $version ]; then - new_version=v1.0.0 - else - new_version=$(echo $version | sed 's/\"//g' | awk -F. '{$NF = $NF + 1;} 1' OFS=.) - fi + version=$(grep -oP '(?<=version = ")(.*)(?=")' "pyproject.toml") + new_version="v${version}" docker build -t hub.airpig.cn/library/$repo:$new_version . docker push hub.airpig.cn/library/$repo:$new_version docker rmi hub.airpig.cn/library/$repo:$new_version diff --git a/.gitea/workflows/build_runtime.yaml b/.gitea/workflows/build_runtime.yaml index 8b078a3..f9fd88d 100644 --- a/.gitea/workflows/build_runtime.yaml +++ b/.gitea/workflows/build_runtime.yaml @@ -25,17 +25,8 @@ jobs: - run: | var=${{ gitea.repository }} repo=${var##*/}"-runtime" - echo $repo - url="https://hub.airpig.cn/api/v2.0/projects/library/repositories/${repo}/artifacts?page=1&page_size=10&with_tag=true&with_label=false&with_scan_overview=false&with_signature=false&with_immutable_status=false&with_accessory=false" - version=$(curl -X 'GET' $url \ - -H 'accept: application/json' \ - -H 'X-Accept-Vulnerabilities: application/vnd.security.vulnerability.report; version=1.1, application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0' \ - -u 'admin:Chenweijia!' | jq '.[0].tags[0].name') - if [ ! $version ]; then - new_version=v1.0.0 - else - new_version=$(echo $version | sed 's/\"//g' | awk -F. '{$NF = $NF + 1;} 1' OFS=.) - fi + ersion=$(grep -oP '(?<=version = ")(.*)(?=")' "pyproject.toml") + new_version="v${version}" docker build -t hub.airpig.cn/library/$repo:$new_version -f RuntimeDockerfile . docker push hub.airpig.cn/library/$repo:$new_version docker rmi hub.airpig.cn/library/$repo:$new_version diff --git a/main.py b/main.py index 8c81a8a..c1d2182 100644 --- a/main.py +++ b/main.py @@ -15,7 +15,6 @@ from src.utils.exception import http_exception_handler, request_validation_error import redis.asyncio as aio_redis from fastapi_limiter import FastAPILimiter - def create_app(): mysql_config, redis_config = init_config() diff --git a/pyproject.toml b/pyproject.toml index 736b759..de3edff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] -name = "fastapi-app-template" -version = "0.1.0" +name = "fastapi-template" +version = "0.1.1" description = "" authors = ["chenwj113 "] license = "MIT"