Skip to content

Commit

Permalink
Github deployment workflow for PyPI
Browse files Browse the repository at this point in the history
  • Loading branch information
Temidayo32 committed Jan 17, 2025
1 parent 2a76bbb commit a8b8014
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 0 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/foxpuppet_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Publish to PyPI


on:
pull_request:
# Sequence of patterns matched against refs/heads
branches:
- main
# on:
# release:
# types:
# - created

env:
PYTHON_VERSION: '3.12'

jobs:
test-and-publish:
name: Publish to PyPI
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 - --version 1.8.5
export PATH="$HOME/.local/bin:$PATH"
- name: Setup Firefox
id: setup-firefox
uses: ./.github/actions/setup_firefox/
with:
firefox-version: ${{ matrix.firefox }}

- run: |
echo Installed firefox versions: ${{ steps.setup-firefox.outputs.firefox-version }}
- name: Install Geckodriver
run: |
wget https://github.com/mozilla/geckodriver/releases/download/v0.35.0/geckodriver-v0.35.0-linux64.tar.gz
tar -xzf geckodriver-v0.35.0-linux64.tar.gz
sudo mv geckodriver /usr/bin/geckodriver
sudo chmod +x /usr/bin/geckodriver
geckodriver --version
- name: Echo Geckodriver Path and Version
run: |
echo "Geckodriver is installed at: $(which geckodriver)"
geckodriver --version
- name: Build the Package
run: poetry build

- name: Install and Test the Wheel
run: |
python -m venv wheel-env
source wheel-env/bin/activate
pip install dist/*.whl
make test
deactivate
- name: Install and Test the Tarball
run: |
python -m venv tarball-env
source tarball-env/bin/activate
pip install dist/*.tar.gz
make test
deactivate
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}

create-release:
name: Create GitHub Release
needs: test-and-publish
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${GITHUB_REF_NAME}" dist/*.whl dist/*.tar.gz \
--title "Release ${GITHUB_REF_NAME}" \
--notes "Automated release of version ${GITHUB_REF_NAME}"
4 changes: 4 additions & 0 deletions .github/workflows/linux_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ jobs:
firefox-version: ${{ matrix.firefox }}
- run: |
echo Installed firefox versions: ${{ steps.setup-firefox.outputs.firefox-version }}
- name: Echo Geckodriver Path and Version
run: |
echo "Geckodriver is installed at: $(which geckodriver)"
geckodriver --version
- name: Setup Python
uses: actions/setup-python@v5
with:
Expand Down

0 comments on commit a8b8014

Please sign in to comment.