Skip to content

Commit

Permalink
Re-add publishing flow
Browse files Browse the repository at this point in the history
  • Loading branch information
ajparsons committed Aug 27, 2024
1 parent 8fd2ee3 commit 6674748
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 27 deletions.
54 changes: 29 additions & 25 deletions .github/workflows/auto_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
type: boolean
default: false
push:
branches: [main-none]
branches: [main]

jobs:

Expand All @@ -31,16 +31,19 @@ jobs:

# run auto either if nothing explicit forced in workflow or it is a push event
publish-auto:
if: ${{ (github.event.inputs.testpypi == 'false' && github.event.inputs.pypi == 'false') || github.event_name == 'push' }}
needs: test
runs-on: ubuntu-latest
steps:
if: ${{ (github.event.inputs.testpypi == 'false' && github.event.inputs.pypi == 'false') || github.event_name == 'push' }}
needs: test
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:

- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Fetch repo name
id: repo_name
run: echo "::set-output name=value::$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')"
run: echo "value=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_OUTPUT

- id: get_status
name: get_status
Expand All @@ -62,32 +65,33 @@ jobs:
env:
TAGS: ${{ steps.get_status.outputs.version_tags }}

- name: Build and publish to pypi
- name: Build
if: ${{ steps.get_status.outputs.remote_exists == 'true' && steps.get_status.outputs.version_difference == 'true'}}
uses: JRubics/[email protected]
with:
pypi_token: ${{ secrets.PYPI_TOKEN }}
run: |
pip install poetry
python -m poetry build
- name: Publish
if: ${{ steps.get_status.outputs.remote_exists == 'true' && steps.get_status.outputs.version_difference == 'true'}}
uses: pypa/gh-action-pypi-publish@release/v1

# run manual if one of the boolean buttons for workflow was used
# this can force the initial creation of the package
publish-manual:
if: ${{ github.event.inputs.testpypi == 'true' || github.event.inputs.pypi == 'true' }}
if: ${{ github.event.inputs.pypi == 'true' }}
needs: test
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:

- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Build and publish to pypi
if: ${{ github.event.inputs.pypi == 'true' }}
uses: JRubics/[email protected]
with:
pypi_token: ${{ secrets.PYPI_TOKEN }}
- name: Build
run: |
pip install poetry
python -m poetry build
- name: Build and publish to testpypi
if: ${{ github.event.inputs.testpypi == 'true' }}
uses: JRubics/[email protected]
with:
pypi_token: ${{ secrets.TEST_PYPI_TOKEN }}
repository_name: "testpypi"
repository_url: "https://test.pypi.org/legacy/"
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Run tests

on:
push:
branches-ignore: [ main-none ]
branches-ignore: [ main ]
pull_request:
branches-ignore: [ main-none ]
branches-ignore: [ main ]
workflow_call:
workflow_dispatch:

Expand Down

0 comments on commit 6674748

Please sign in to comment.