-
Notifications
You must be signed in to change notification settings - Fork 5
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 #18 from PCain02/main
feat: Automatic PyPI Publishing using Tags
- Loading branch information
Showing
5 changed files
with
134 additions
and
3 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
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
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,57 @@ | ||
# Publishing workflow | ||
|
||
name: Publish | ||
|
||
# Use more columns for terminal output | ||
env: | ||
COLUMNS: 120 | ||
PYTHONIOENCODING: utf8 | ||
|
||
# trigger the publishing of the | ||
# execexam package to PyPI | ||
# with any tag starting with 'v' | ||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
# Create one single job | ||
# that publishes the package | ||
# to PyPI using Poetry | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.12' | ||
- name: Install Poetry | ||
run: | | ||
curl -sSL https://install.python-poetry.org | python3 - | ||
echo "$HOME/.local/bin" >> $GITHUB_PATH | ||
- name: Install dependencies | ||
run: | | ||
poetry install | ||
- name: Configure Poetry for PyPI | ||
run: | | ||
poetry config repositories.pypi https://upload.pypi.org/legacy/ | ||
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} | ||
- name: Publish package to PyPI | ||
run: | | ||
poetry publish --repository pypi --build | ||
- name: Check for Successful Publication | ||
run: | | ||
version=$(poetry version --short) | ||
echo "Checking if package execexam version $version is available on PyPI..." | ||
response=$(curl -s "https://pypi.org/pypi/execexam/$version/json") | ||
if echo "$response" | grep -q "$version"; then | ||
echo "Package execexam version $version is successfully published on PyPI." | ||
else | ||
echo "Package execexam version $version was not found on PyPI." | ||
exit 1 | ||
fi | ||
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,48 @@ | ||
name: Test Publish | ||
|
||
on: | ||
push: | ||
tags: | ||
- 't*' # Triggers on tags starting with 't' | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '^3.11' # Use the Python version compatible with your project | ||
|
||
- name: Install Poetry | ||
run: | | ||
curl -sSL https://install.python-poetry.org | python3 - | ||
echo "$HOME/.local/bin" >> $GITHUB_PATH | ||
- name: Install dependencies | ||
run: | | ||
poetry install | ||
- name: Configure Poetry for TestPyPI | ||
run: | | ||
poetry config repositories.testpypi https://test.pypi.org/legacy/ | ||
poetry config pypi-token.testpypi ${{ secrets.TEST_PYPI_TOKEN }} | ||
- name: Publish package to TestPyPI | ||
run: | | ||
poetry publish --repository testpypi --build | ||
- name: Check for Successful Publication | ||
run: | | ||
version=$(poetry version --short) | ||
echo "Checking if package execexam version $version is available on TestPyPI..." | ||
response=$(curl -s "https://test.pypi.org/pypi/execexam/$version/json") | ||
if echo "$response" | grep -q "$version"; then | ||
echo "Package execexam version $version is successfully published on TestPyPI." | ||
else | ||
echo "Package execexam version $version was not found on TestPyPI." | ||
exit 1 | ||
fi |
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 @@ | ||
|