Release #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: Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| testpypi: | |
| description: 'Release to TestPyPI then skip following' | |
| default: 'false' | |
| type: choice | |
| options: | |
| - 'true' | |
| - 'false' | |
| jobs: | |
| build-release: | |
| permissions: | |
| # write permission is required to create a github release | |
| contents: write | |
| # write permission is required for autolabeler | |
| # otherwise, read permission is required at least | |
| pull-requests: read | |
| runs-on: ubuntu-latest | |
| # Use the oldest supported version to build, just in case there are issues | |
| # for our case, this doesn't matter that much, since the build is for 3.x | |
| strategy: | |
| matrix: | |
| include: | |
| - py_ver: "3.9" | |
| env: | |
| PY_VER: ${{matrix.py_ver}} | |
| TWINE_USERNAME: ${{secrets.twine_username}} | |
| TWINE_PASSWORD: ${{secrets.twine_password}} | |
| TWINE_TEST_USERNAME: ${{secrets.twine_test_username}} | |
| TWINE_TEST_PASSWORD: ${{secrets.twine_test_password}} | |
| TESTPYPI: ${{ github.event.inputs.testpypi }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{matrix.py_ver}} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{matrix.py_ver}} | |
| # Merging build and release steps just for the simplicity, | |
| # since datajoint-python doesn't have platform specific dependencies or binaries, | |
| # and the build process is fairly fast, so removed upload/download artifacts | |
| - name: Build package | |
| id: build | |
| run: | | |
| python -m pip install build | |
| python -m build . | |
| echo "DJ_WHEEL_PATH=$(ls dist/datajoint-*.whl)" >> $GITHUB_ENV | |
| echo "DJ_SDIST_PATH=$(ls dist/datajoint-*.tar.gz)" >> $GITHUB_ENV | |
| echo "DJ_VERSION=$(grep -oP '\d+\.\d+\.\d+' datajoint/version.py)" >> $GITHUB_OUTPUT | |
| # - name: Publish package | |
| # run: | | |
| # export HOST_UID=$(id -u) | |
| # if [ "$TESTPYPI" == "true" ]; then | |
| # export TWINE_REPOSITORY="testpypi" | |
| # export TWINE_USERNAME=${TWINE_TEST_USERNAME} | |
| # export TWINE_PASSWORD=${TWINE_TEST_PASSWORD} | |
| # else | |
| # export TWINE_REPOSITORY="pypi" | |
| # fi | |
| # docker compose run --build --quiet-pull \ | |
| # -e TWINE_USERNAME=${TWINE_USERNAME} \ | |
| # -e TWINE_PASSWORD=${TWINE_PASSWORD} \ | |
| # -e TWINE_REPOSITORY=${TWINE_REPOSITORY} \ | |
| # app sh -c "pip install twine && python -m twine upload dist/*" | |
| # Drafts your next Release notes as Pull Requests are merged into "master" | |
| - name: Draft release notes | |
| id: create_gh_release | |
| uses: release-drafter/release-drafter@v6 | |
| if: ${{ github.event.inputs.testpypi == 'false' }} | |
| with: | |
| config-name: release_drafter.yaml | |
| disable-autolabeler: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # Upload package as release assets | |
| - name: Upload pip wheel asset to release | |
| if: ${{ github.event.inputs.testpypi == 'false' }} | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
| with: | |
| upload_url: ${{steps.create_gh_release.outputs.upload_url}} | |
| asset_path: ${{env.DJ_WHEEL_PATH}} | |
| asset_name: pip-datajoint-${{env.DJ_VERSION}}.whl | |
| asset_content_type: application/zip | |
| - name: Upload pip sdist asset to release | |
| if: ${{ github.event.inputs.testpypi == 'false' }} | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
| with: | |
| upload_url: ${{steps.create_gh_release.outputs.upload_url}} | |
| asset_path: ${{env.DJ_SDIST_PATH}} | |
| asset_name: pip-datajoint-${{env.DJ_VERSION}}.tar.gz | |
| asset_content_type: application/gzip |