From d2c152aebcc6b3772b5b201a7f2fbe15b309ad11 Mon Sep 17 00:00:00 2001 From: Mohamed Gaber Date: Sun, 19 Jan 2025 15:49:17 +0200 Subject: [PATCH] ci: change pypi upload flow --- .github/actions/setup_env/action.yml | 2 +- .github/workflows/ci.yml | 16 +--------------- .github/workflows/pypi.yml | 25 +++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/pypi.yml diff --git a/.github/actions/setup_env/action.yml b/.github/actions/setup_env/action.yml index d77219552..5d06d8495 100644 --- a/.github/actions/setup_env/action.yml +++ b/.github/actions/setup_env/action.yml @@ -18,7 +18,7 @@ runs: - name: Check if publishing branch shell: bash run: | - if [[ "$BRANCH_NAME" == "main" || "$BRANCH_NAME" == version* ]]; then + if [[ "$BRANCH_NAME" == "main" || "$BRANCH_NAME" == "dev" || "$BRANCH_NAME" == version* ]]; then echo "PUBLISHING_BRANCH=1" >> $GITHUB_ENV fi diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6391aab98..6a2947b2a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -439,7 +439,7 @@ jobs: git commit -m "Upload" git remote add origin "https://${{ vars.BOT_USERNAME }}:${{ secrets.GH_TOKEN }}@github.com/$REPO.git" git push -fu origin $BRANCH_NAME # Force for if we have to re-run the CI for some reason - publish: + publish-tag: runs-on: ubuntu-22.04 needs: [build-linux-amd64, build-docker, build-py] name: Publish (If Applicable) @@ -487,20 +487,6 @@ jobs: ghcr.io/${{ github.repository }}:$NEW_TAG-aarch64 docker manifest push ghcr.io/${{ github.repository }}:$NEW_TAG - - name: Set Up Python - if: ${{ env.PUBLISH == '1' }} - uses: actions/setup-python@v4 - with: - python-version: "3.8" - - name: Build Distribution - if: ${{ env.PUBLISH == '1' }} - run: | - make dist - - name: Publish - if: ${{ env.PUBLISH == '1' }} - uses: pypa/gh-action-pypi-publish@master - with: - password: ${{ secrets.PYPI_API_TOKEN }} - name: Tag Commit if: ${{ env.PUBLISH == '1' }} uses: tvdias/github-tagger@v0.0.1 diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml new file mode 100644 index 000000000..657b3c37b --- /dev/null +++ b/.github/workflows/pypi.yml @@ -0,0 +1,25 @@ +name: New tag to PyPI +on: + push: + # Pattern matched against refs/tags + tags: + - "*" +jobs: + publish-pypi: + runs-on: ubuntu-24.04 + steps: + - name: Check out repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set Up Python + uses: actions/setup-python@v4 + with: + python-version: "3.8" + - name: Build Distribution + run: | + make dist + - name: Publish + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }}