Skip to content

Commit

Permalink
ci: change pypi upload flow
Browse files Browse the repository at this point in the history
  • Loading branch information
donn committed Jan 19, 2025
1 parent 856cbf0 commit d2c152a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/actions/setup_env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 1 addition & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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/[email protected]
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -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 }}

0 comments on commit d2c152a

Please sign in to comment.