-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #78 from enoch3712/77-split-workflows-publish-only…
…-triggered-by-admin new workflows
- Loading branch information
Showing
2 changed files
with
38 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Manual PyPI Publish | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Version to publish (optional)' | ||
required: false | ||
type: string | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install poetry | ||
poetry install | ||
- name: Update version if provided | ||
if: inputs.version != '' | ||
run: poetry version ${{ inputs.version }} | ||
|
||
- name: Build package | ||
run: poetry build | ||
|
||
- name: Publish to PyPI | ||
uses: pypa/[email protected] | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,29 +31,6 @@ jobs: | |
- name: Build package | ||
run: poetry build | ||
|
||
- name: Check version change | ||
id: check_version | ||
run: | | ||
git fetch origin main | ||
# Extract version from current pyproject.toml | ||
current_version=$(poetry version -s) | ||
# Extract version from main branch pyproject.toml | ||
main_version=$(git show origin/main:pyproject.toml | grep "^version = " | cut -d'"' -f2) | ||
if [ "$current_version" != "$main_version" ]; then | ||
echo "Version changed from $main_version to $current_version" | ||
echo "version_changed=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "Version unchanged" | ||
echo "version_changed=false" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Publish to PyPI | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.check_version.outputs.version_changed == 'true' | ||
uses: pypa/[email protected] | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
|
||
test-python-versions: | ||
name: Test Python ${{ matrix.python-version }} | ||
runs-on: ubuntu-latest | ||
|