1111 - ' false'
1212jobs :
1313 build-release :
14+ permissions :
15+ # write permission is required to create a github release
16+ contents : write
17+ # write permission is required for autolabeler
18+ # otherwise, read permission is required at least
19+ pull-requests : read
1420 runs-on : ubuntu-latest
1521 # Use the oldest supported version to build, just in case there are issues
1622 # for our case, this doesn't matter that much, since the build is for 3.x
@@ -35,11 +41,13 @@ jobs:
3541 # since datajoint-python doesn't have platform specific dependencies or binaries,
3642 # and the build process is fairly fast, so removed upload/download artifacts
3743 - name : Build package
44+ id : build
3845 run : |
3946 python -m pip install build
4047 python -m build .
4148 echo "DJ_WHEEL_PATH=$(ls dist/datajoint-*.whl)" >> $GITHUB_ENV
4249 echo "DJ_SDIST_PATH=$(ls dist/datajoint-*.tar.gz)" >> $GITHUB_ENV
50+ echo "DJ_VERSION=$(grep -oP '\d+\.\d+\.\d+' datajoint/version.py)" >> $GITHUB_OUTPUT
4351 - name : Publish package
4452 run : |
4553 export HOST_UID=$(id -u)
@@ -55,48 +63,16 @@ jobs:
5563 -e TWINE_PASSWORD=${TWINE_PASSWORD} \
5664 -e TWINE_REPOSITORY=${TWINE_REPOSITORY} \
5765 app sh -c "pip install twine && python -m twine upload dist/*"
58- - name : Login to DockerHub
66+ # Drafts your next Release notes as Pull Requests are merged into "master"
67+ - name : Draft release notes
68+ id : create_gh_release
69+ uses : release-drafter/release-drafter@v6
5970 if : ${{ github.event.inputs.testpypi == 'false' }}
60- uses : docker/login-action@v3
6171 with :
62- username : ${{secrets.docker_username}}
63- password : ${{secrets.docker_password}}
64- - name : Publish image
65- if : ${{ github.event.inputs.testpypi == 'false' }}
66- run : |
67- IMAGE=$(docker images --filter "reference=datajoint/datajoint*" --format "{{.Repository}}")
68- TAG=$(docker images --filter "reference=datajoint/datajoint*" --format "{{.Tag}}")
69- docker push "${IMAGE}:${TAG}"
70- docker tag "${IMAGE}:${TAG}" "${IMAGE}:${TAG}-${GITHUB_SHA:0:7}"
71- docker push "${IMAGE}:${TAG}-${GITHUB_SHA:0:7}"
72- [ "$PY_VER" == "3.9" ] && [ "$DISTRO" == "debian" ] \
73- && docker tag "${IMAGE}:${TAG}" "${IMAGE}:latest" \
74- && docker push "${IMAGE}:latest" \
75- || echo "skipping 'latest' tag..."
76- # Make sure all above release targets are done first, then make a GH release
77- - name : Make release notes
78- if : ${{ github.event.inputs.testpypi == 'false' }}
79- run : |
80- DJ_VERSION=$(grep -oP '\d+\.\d+\.\d+' datajoint/version.py)
81- RELEASE_BODY=$(python -c \
82- 'print(open("./CHANGELOG.md").read().split("\n\n")[1].split("\n", 1)[1])' \
83- )
84- echo "DJ_VERSION=${DJ_VERSION}" >> $GITHUB_ENV
85- echo "RELEASE_BODY<<EOF" >> $GITHUB_ENV
86- echo "$RELEASE_BODY" >> $GITHUB_ENV
87- echo "EOF" >> $GITHUB_ENV
88- - name : Create GH release
89- if : ${{ github.event.inputs.testpypi == 'false' }}
90- id : create_gh_release
91- uses : actions/create-release@v1
72+ config-name : release_drafter.yaml
73+ disable-autolabeler : true
9274 env :
93- GITHUB_TOKEN : ${{secrets.GITHUB_TOKEN}}
94- with :
95- tag_name : ${{env.DJ_VERSION}}
96- release_name : Release ${{env.DJ_VERSION}}
97- body : ${{env.RELEASE_BODY}}
98- prerelease : false
99- draft : false
75+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
10076 # Upload package as release assets
10177 - name : Upload pip wheel asset to release
10278 if : ${{ github.event.inputs.testpypi == 'false' }}
@@ -118,10 +94,3 @@ jobs:
11894 asset_path : ${{env.DJ_SDIST_PATH}}
11995 asset_name : pip-datajoint-${{env.DJ_VERSION}}.tar.gz
12096 asset_content_type : application/gzip
121- # only release docs when a release is published
122- call-publish-docs :
123- if : ${{ github.event.inputs.testpypi == 'false' }}
124- needs : build-release
125- runs-on : ubuntu-latest
126- steps :
127- - uses : ./.github/workflows/docs.yaml
0 commit comments