-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Trying to call newly implemented CD * added secret inheritance * CD is triggered on main branch --------- Co-authored-by: Pascal Epple <[email protected]>
- Loading branch information
1 parent
c52e6c5
commit 2eda02f
Showing
1 changed file
with
4 additions
and
61 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 |
---|---|---|
@@ -1,67 +1,10 @@ | ||
|
||
name: CD Pipeline | ||
name: Deploy Minor Bump to PyPI | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
workflow_dispatch: | ||
inputs: | ||
major_update: | ||
description: 'Set it to true to bump a major version' | ||
required: false | ||
default: false | ||
type: choice | ||
options: | ||
- true | ||
- false | ||
|
||
jobs: | ||
publish-to-pypi: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Clone the repository with full history depth to retrieve all tags | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.9 | ||
|
||
- run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install --upgrade setuptools wheel | ||
python -m pip install --upgrade twine | ||
python -m pip install --upgrade setuptools_scm | ||
python -m pip install --upgrade build | ||
python -m pip install --upgrade semver | ||
- name: Increment the git tag | ||
run: | | ||
# get the current git tag | ||
CURRENT_TAG=$(git describe --tags --abbrev=0) | ||
if [ "${{inputs.major_update}}" == "true" ]; then | ||
# Increment the tag by a major version with the semver python package | ||
NEW_TAG=$(python -c "import semver; print(semver.bump_major('$CURRENT_TAG'))") | ||
else | ||
# Increment the tag by a minor version with the semver python package | ||
NEW_TAG=$(python -c "import semver; print(semver.bump_minor('$CURRENT_TAG'))") | ||
fi | ||
git tag $NEW_TAG | ||
# push the tag to the remote repository | ||
git push origin $NEW_TAG | ||
- name: Retrieve the package version using setuptools_scm and publish to PyPI | ||
run: | | ||
# Use setuptools_scm to get the current version and echo it | ||
PACKAGE_VERSION=$(python -c "import setuptools_scm; print(setuptools_scm.get_version())") | ||
echo "Package version: $PACKAGE_VERSION" | ||
# Build the package using setuptools_scm for versioning | ||
python -m build | ||
# Publish the package to PyPI using twine | ||
python -m twine upload dist/* | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | ||
minor-bump-project-deployment: | ||
uses: VisiumCH/deploy-to-pypi/.github/workflows/cd.yaml@main | ||
secrets: inherit |