Merge pull request #25 from jcam1/develop #9
This file contains hidden or 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
| name: publish | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'packages/**' | |
| workflow_dispatch: | |
| jobs: | |
| detect-changes: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 3 | |
| permissions: | |
| pull-requests: read | |
| outputs: | |
| core: ${{ steps.filter.outputs.core }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| filters: | | |
| core: | |
| - 'packages/core/**' | |
| push-git-tag: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ./ | |
| timeout-minutes: 3 | |
| outputs: | |
| tag-name: ${{ 'v' }}${{ env.GIT_TAG_VERSION }} | |
| tag-version: ${{ env.GIT_TAG_VERSION }} | |
| tag-exists: ${{ steps.create-tag.outputs.tag_exists }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/install-packages | |
| - name: get version from `pyproject.toml` | |
| run: | | |
| package_version=$(grep -m 1 version pyproject.toml | grep -Ee '[0-9]+.[0-9]+.[0-9]+' -o) | |
| echo "GIT_TAG_VERSION=$package_version" >> $GITHUB_ENV | |
| - uses: rickstaa/action-create-tag@v1 | |
| id: create-tag | |
| with: | |
| tag: ${{ 'v' }}${{ env.GIT_TAG_VERSION }} | |
| publish-release-note: | |
| needs: push-git-tag | |
| if: ${{ needs.push-git-tag.outputs.tag-exists == 'false' }} | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ./ | |
| timeout-minutes: 5 | |
| permissions: | |
| contents: write | |
| pull-requests: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: release-drafter/release-drafter@v6 | |
| with: | |
| name: ${{ needs.push-git-tag.outputs.tag-name }} | |
| tag: ${{ needs.push-git-tag.outputs.tag-name }} | |
| version: ${{ needs.push-git-tag.outputs.tag-version }} | |
| publish: 'true' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| publish-core: | |
| needs: [detect-changes, publish-release-note] | |
| if: ${{ needs.detect-changes.outputs.core == 'true' }} | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ./packages/core | |
| timeout-minutes: 5 | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/install-packages | |
| - name: Build package | |
| run: uv build --no-cache | |
| - name: Publish package to PyPI | |
| # NOTE: need to specify directory bc `dist` directory is generated at the root-level | |
| run: uv publish --no-cache --directory ../../ |