v6.0.0.rc1 #45
Workflow file for this run
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 to PyPI | |
| on: | |
| release: | |
| types: [published] | |
| jobs: | |
| validate-release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Validate pre-release consistency | |
| env: | |
| TAG_NAME: ${{ github.event.release.tag_name }} | |
| IS_PRERELEASE: ${{ github.event.release.prerelease }} | |
| run: | | |
| PEP440_PRE=$(echo "$TAG_NAME" | grep -qE '(\.dev|a|b|rc)[0-9]+' && echo "true" || echo "false") | |
| if [ "$IS_PRERELEASE" = "true" ] && [ "$PEP440_PRE" = "false" ]; then | |
| echo "::error::GitHub release is marked as pre-release but tag '$TAG_NAME' is a stable version. Use a PEP 440 pre-release suffix (e.g. .dev1, rc1)." | |
| exit 1 | |
| fi | |
| if [ "$IS_PRERELEASE" = "false" ] && [ "$PEP440_PRE" = "true" ]; then | |
| echo "::error::Tag '$TAG_NAME' has a pre-release suffix but the GitHub release is not marked as pre-release. Check the 'Set as a pre-release' box." | |
| exit 1 | |
| fi | |
| echo "Release consistency check passed: tag=$TAG_NAME, prerelease=$IS_PRERELEASE" | |
| publish: | |
| needs: validate-release | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/project/salesforce-data-customcode/ | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install Poetry | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install poetry | |
| - name: Install project dependencies | |
| run: poetry install --no-interaction --only main | |
| - name: Build package | |
| run: make package | |
| - name: Publish to PyPI | |
| env: | |
| PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
| run: poetry publish --username __token__ --password $PYPI_TOKEN |