From 364c94be06709d81b999a8ee0653bb79f57b0e5c Mon Sep 17 00:00:00 2001 From: danielfromearth Date: Wed, 20 Sep 2023 11:36:40 -0400 Subject: [PATCH 1/4] add pypi steps to workflow --- .../{lint_and_test_and_bump.yml => push.yml} | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) rename .github/workflows/{lint_and_test_and_bump.yml => push.yml} (83%) diff --git a/.github/workflows/lint_and_test_and_bump.yml b/.github/workflows/push.yml similarity index 83% rename from .github/workflows/lint_and_test_and_bump.yml rename to .github/workflows/push.yml index 7671fa5..3d1fef1 100644 --- a/.github/workflows/lint_and_test_and_bump.yml +++ b/.github/workflows/push.yml @@ -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 \ No newline at end of file From 65b6cf9aa134eddaba8202f59e578949c42d05f4 Mon Sep 17 00:00:00 2001 From: danielfromearth Date: Wed, 20 Sep 2023 11:37:00 -0400 Subject: [PATCH 2/4] rename workflow file --- .../{lint_and_test_on_pull_request.yml => pull_request.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{lint_and_test_on_pull_request.yml => pull_request.yml} (100%) diff --git a/.github/workflows/lint_and_test_on_pull_request.yml b/.github/workflows/pull_request.yml similarity index 100% rename from .github/workflows/lint_and_test_on_pull_request.yml rename to .github/workflows/pull_request.yml From e277bdbce513164294b1dcd59897d13acf48d148 Mon Sep 17 00:00:00 2001 From: danielfromearth Date: Wed, 20 Sep 2023 11:37:12 -0400 Subject: [PATCH 3/4] add release_created.yml --- .github/workflows/release_created.yml | 38 +++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/release_created.yml diff --git a/.github/workflows/release_created.yml b/.github/workflows/release_created.yml new file mode 100644 index 0000000..61aeb23 --- /dev/null +++ b/.github/workflows/release_created.yml @@ -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/actions-poetry@v2.3.0 + 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 'ncompare@noreply.github.com' + git commit -am "/version ${{ env.software_version }}" + git push From c5d90c64ea50faae6f54d74c0e362242f39779bc Mon Sep 17 00:00:00 2001 From: danielfromearth Date: Wed, 20 Sep 2023 11:50:29 -0400 Subject: [PATCH 4/4] udpate CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5186c29..c0977c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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