Skip to content

Commit

Permalink
update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Tburm committed Oct 12, 2023
1 parent 1f8e82c commit 5d15c8a
Showing 1 changed file with 39 additions and 9 deletions.
48 changes: 39 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: PyPi Publish
name: CI/CD Pipeline

on:
push:
Expand All @@ -9,7 +9,7 @@ on:
- v3-competition

jobs:
build-and-install:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -18,17 +18,47 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install ./src
deploy-testpypi:
needs: build-and-test
if: github.event_name == 'pull_request' && github.ref == 'refs/heads/v3-competition'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install twine
- name: Build
run: |
python setup.py sdist bdist_wheel
- name: Publish to Test PyPi with unique version
run: |
VERSION_SUFFIX=$(echo "${{ github.sha }}" | cut -c1-7)
twine upload --repository-url https://test.pypi.org/legacy/ dist/* --verbose --skip-existing
env:
TWINE_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}

deploy:
needs: build-and-install
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: build-and-test
if: github.event_name == 'push' && github.ref == 'refs/heads/v3-competition'
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -37,7 +67,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: 3.8

- name: Install dependencies
run: |
Expand All @@ -53,8 +83,8 @@ jobs:
- name: Build and publish
run: |
python ./src/setup.py sdist bdist_wheel
twine upload dist/*
python setup.py sdist bdist_wheel
twine upload dist/* --skip-existing
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}

0 comments on commit 5d15c8a

Please sign in to comment.