Skip to content

Commit

Permalink
ci: rely on outputs of semantic-release command for jobs orchestration
Browse files Browse the repository at this point in the history
  • Loading branch information
the-forest-tree committed Oct 2, 2023
1 parent 0b57030 commit 536c56e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/hrflow_connectors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ jobs:
cd:
runs-on: ubuntu-latest
if: github.event.commits[0].author.name != 'hrflow-semantic-release' && github.event_name == 'push' && github.ref == 'refs/heads/master'
outputs:
new-release: ${{ steps.semantic-release.outputs.released }}
needs: [core-tests]
environment: release
steps:
Expand Down Expand Up @@ -198,32 +200,31 @@ jobs:
key: venv-${{ runner.os }}-${{ env.BASELINE_PYTHON_VERSION }}-${{ hashFiles('**/poetry.lock') }}

- name: Prepare new release
id: publish-pipy
id: semantic-release
env:
GH_TOKEN: ${{ secrets.PUBLISH_GITHUB_TOKEN }}
run: |
echo "PKG_VERSION=$(poetry run semantic-release --noop version --print)" >> "$GITHUB_OUTPUT"
poetry run semantic-release version
poetry run semantic-release publish
- name: Publish to TestPyPI
if: ${{ hashFiles('dist/') != '' }}
if: ${{ steps.semantic-release.outputs.released == 'true' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/

- name: Test install from TestPyPI
if: ${{ hashFiles('dist/') != '' }}
if: ${{ steps.semantic-release.outputs.released == 'true' }}
run: |
pip install \
--index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple \
hrflow-connectors==${{ steps.publish-pipy.outputs.PKG_VERSION }}
hrflow-connectors==${{ steps.semantic-release.outputs.version }}
- name: Publish to PyPI
if: ${{ hashFiles('dist/') != '' }}
if: ${{ steps.semantic-release.outputs.released == 'true' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
Expand All @@ -232,6 +233,7 @@ jobs:
post-release:
runs-on: ubuntu-latest
needs: [cd]
if: needs.cd.outputs.new-release == 'true'
environment: release
steps:
- name: Dispatch Update Workflows2.0 Environment
Expand Down

0 comments on commit 536c56e

Please sign in to comment.