Skip to content

Commit

Permalink
change release stage back to if a tag is pushed
Browse files Browse the repository at this point in the history
  • Loading branch information
SimLi1333 committed Nov 27, 2024
1 parent 5a9c6d3 commit 8c4713c
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,42 +132,29 @@ jobs:

release:
name: Releasing to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') # Trigger on tag push
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: [linters, pytest]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Determine Source Branch
id: get_branch
run: echo "branch=$(git show -s --pretty=%D HEAD | grep -o 'origin/main')" >> $GITHUB_ENV

- name: Verify Source Branch is Main
if: env.branch == 'origin/main'
run: echo "Tag was created on main branch."


- name: Install Poetry
if: env.branch == 'origin/main'
uses: snok/install-poetry@v1

- name: Build release
if: env.branch == 'origin/main'
- name: build release
run: poetry build

- name: Publish package to PyPI
if: env.branch == 'origin/main'
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

- uses: actions/upload-artifact@v4
if: env.branch == 'origin/main'
with:
name: build
path: dist/*
path: dist/*

0 comments on commit 8c4713c

Please sign in to comment.