Skip to content

Commit

Permalink
updating publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
ronnnnnnnnnnnnn committed Aug 21, 2024
1 parent ac29078 commit 71d7e18
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Publish

on:
push:
branches: [main]
release:
types: [published]

Expand All @@ -14,18 +12,17 @@ jobs:
python-version: ["3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3

- uses: actions/checkout@v4
- name: Cache pip
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -38,11 +35,11 @@ jobs:
publish-test:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'release'
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.12'

Expand Down Expand Up @@ -70,11 +67,11 @@ jobs:
publish-prod:
needs: [build, publish-test]
runs-on: ubuntu-latest
if: github.event_name == 'release'
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.12'

Expand All @@ -86,7 +83,7 @@ jobs:
- name: Build package
run: python -m build

- name: Publish to PyPI
- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
Expand Down

0 comments on commit 71d7e18

Please sign in to comment.