Cut new version #17
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: Cut new version | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| check-new-version: | |
| runs-on: ubuntu-latest | |
| permissions: write-all | |
| steps: | |
| - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 | |
| with: | |
| python-version: '3.11' | |
| - run: pip install -U pip | |
| - run: pip install bumpver git+https://github.com/morganstanley/releaseherald.git | |
| - run: | | |
| bumpver show --env > new-version.txt | |
| cat new-version.txt | |
| - name: check tag manually created & matched | |
| run: | | |
| set -x | |
| eval $(cat new-version.txt) | |
| echo -e "Current tag:\n$(git tag --points-at HEAD)" | |
| echo "Expected tag: ${CURRENT_VERSION}" | |
| if [[ ! $(git tag --points-at HEAD) =~ "${CURRENT_VERSION}" ]]; then | |
| echo "Tag not properly set, aborting..." | |
| exit 1 | |
| fi | |
| shell: bash | |
| - run: releaseherald generate --latest --no-update -t news.rst | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: new-version | |
| path: | | |
| new-version.txt | |
| news.rst | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: check-new-version | |
| steps: | |
| - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
| - run: git pull origin | |
| - uses: ./.github/actions/build-package | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: package | |
| path: dist/ | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: write-all | |
| needs: [check-new-version, build] | |
| steps: | |
| - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
| with: | |
| sparse-checkout: | | |
| .github | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: new-version | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: package | |
| path: dist/ | |
| - name: Get Version | |
| id: get_version | |
| run: | | |
| eval $(cat new-version.txt) | |
| echo "new_version=${CURRENT_VERSION}" >> $GITHUB_OUTPUT | |
| - uses: ./.github/actions/create-release | |
| with: | |
| tag_name: ${{ steps.get_version.outputs.new_version }} | |
| package: dist/testplan-${{ steps.get_version.outputs.new_version }}-py3-none-any.whl | |
| news: news.rst | |
| - name: Publish to Test PyPI | |
| if: ${{github.ref_name == 'test_pypi'}} | |
| uses: pypa/[email protected] | |
| with: | |
| password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
| repository-url: https://test.pypi.org/legacy/ | |
| - name: Publish to PyPI | |
| if: ${{github.ref_name != 'test_pypi'}} | |
| uses: pypa/[email protected] | |
| with: | |
| password: ${{ secrets.PYPI_API_TOKEN }} |