Skip to content

Commit

Permalink
Merge pull request #25 from nasa/feature/issue-19
Browse files Browse the repository at this point in the history
Feature/issue 19 - Adding PyPI steps to Actions workflow
  • Loading branch information
danielfromearth authored Sep 20, 2023
2 parents 15201c3 + c5d90c6 commit af2bb3f
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,31 @@ jobs:
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git tag -a "${{ env.software_version }}" -m "Version ${{ env.software_version }}"
git push origin "${{ env.software_version }}"
- name: Build Python Artifact
run: |
poetry build
- uses: actions/upload-artifact@v2
with:
name: python-artifact
path: dist/*

- name: Publish to test.pypi.org
id: pypi-test-publish
if: |
github.ref == 'refs/heads/develop' ||
startsWith(github.ref, 'refs/heads/release')
env:
POETRY_PYPI_TOKEN_TESTPYPI: ${{secrets.POETRY_PYPI_TOKEN_TESTPYPI}}
run: |
poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry publish -r testpypi
- name: Publish to pypi.org
if: ${{ github.ref == 'refs/heads/main' }}
id: pypi-publish
env:
POETRY_PYPI_TOKEN_PYPI: ${{secrets.POETRY_PYPI_TOKEN_PYPI}}
run: |
poetry publish
38 changes: 38 additions & 0 deletions .github/workflows/release_created.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release Branch Created

# Run whenever a ref is created https://docs.github.com/en/actions/reference/events-that-trigger-workflows#create
on:
create

jobs:
# First job in the workflow builds and verifies the software artifacts
bump:
name: Bump minor version on develop
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Only run if ref created was a release branch
if:
${{ startsWith(github.ref, 'refs/heads/release/') }}
steps:
# Checks-out the develop branch
- uses: actions/checkout@v3
with:
ref: 'refs/heads/develop'
- uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install Poetry
uses: abatilo/[email protected]
with:
poetry-version: 1.3.2
- name: Bump minor version
run: |
poetry version ${GITHUB_REF#refs/heads/release/}
poetry version preminor
echo "software_version=$(poetry version | awk '{print $2}')" >> $GITHUB_ENV
- name: Commit Version Bump
run: |
git config --global user.name 'ncompare bot'
git config --global user.email '[email protected]'
git commit -am "/version ${{ env.software_version }}"
git push
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]
### Added
- [issue/19](https://github.com/nasa/ncompare/issues/19): Add automated publishing (via poetry) to TestPyPI and PyPI in Actions workflow
### Changed
- [issue/23](https://github.com/nasa/ncompare/issues/23): Use ruff and black for linting and formatting
### Deprecated
Expand Down

0 comments on commit af2bb3f

Please sign in to comment.