Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added pypi release github actions #148

Merged
merged 2 commits into from
Apr 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: PyPI Release

on:
release:
types: [created]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install wheel twine
pip install -r requirements.txt
- name: Build distribution package
run: |
python setup.py sdist bdist_wheel
- name: Upload to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
twine upload dist/*
33 changes: 33 additions & 0 deletions .github/workflows/publish-to-test-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Test PyPI Release

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install wheel twine
pip install -r requirements.txt
- name: Build distribution package
run: |
python setup.py sdist bdist_wheel
- name: Upload to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
run: |
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
- name: Install package from TestPyPI
run: |
python -m pip install --index-url https://test.pypi.org/simple/ --no-deps shelvery
33 changes: 0 additions & 33 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -108,39 +108,6 @@ pipeline {
}
}
}

stage('Release PyPI'){
when {
branch 'master'
}
steps {
input 'Release to PyPI'
script {
withCredentials([usernamePassword(credentialsId: '/ci2/jenkins/credentials/base2-pypi', usernameVariable: 'PYPICREDS_USR', passwordVariable: 'PYPICREDS_PSW')]) {
sh """#!/bin/bash
cat << EOT > /root/.pypirc
[distutils]
index-servers =
pypi
pypitest

[pypi]
repository=https://pypi.org/pypi
username=\${PYPICREDS_USR}
password=\${PYPICREDS_PSW}
EOT

python setup.py sdist upload -r pypi
"""
}
}
}
post {
success {
slackSend color: '#00FF00', channel: '#base2-tool-releases', message: "<https://pypi.python.org/pypi/shelvery|New Shelvery Release on PyPI>"
}
}
}

}

Expand Down