From 08860faa4675df86185a6d59b285c3ddeb4cc171 Mon Sep 17 00:00:00 2001 From: Simon Diesenreiter Date: Wed, 13 Nov 2024 16:54:42 +0100 Subject: [PATCH] add version amtch check --- .gitea/workflows/release.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index e0cccbd..28a2659 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -6,7 +6,7 @@ on: push: # Sequence of patterns matched against refs/tags tags: - - '*' # Push events to matching v*, i.e. v1.0, v20.15.10 + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -43,6 +43,17 @@ jobs: run: | python -m pip install --upgrade pip pip install setuptools wheel twine + - name: Check version match + run: | + REPOSITORY_NAME=$(echo "$GITHUB_REPOSITORY" | awk -F '/' '{print $2}' | tr '-' '_' | tr '[:upper:]' '[:lower:]') + test "$(cat $REPOSITORY_NAME/VERSION)" = "${GITHUB_REF_NAME:1}" + SUCCESS=$? + if $SUCCESS; then + echo "Version matches successfully!" + else + echo "Version must match!" + return -1 + fi - name: Build and publish env: TWINE_USERNAME: __token__ @@ -50,6 +61,5 @@ jobs: run: | REPOSITORY_OWNER=$(echo "$GITHUB_REPOSITORY" | awk -F '/' '{print $1}') python setup.py sdist bdist_wheel - echo "uploading to: https://git.disi.dev/api/packages/$REPOSITORY_OWNER/pypi" twine upload --repository-url https://git.disi.dev/api/packages/$REPOSITORY_OWNER/pypi -u gitearobot -p ${{ secrets.PACKAGE_GITEA_PAT }} dist/* -- 2.45.2