11
11
- ' false'
12
12
jobs :
13
13
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
14
20
runs-on : ubuntu-latest
15
21
# Use the oldest supported version to build, just in case there are issues
16
22
# for our case, this doesn't matter that much, since the build is for 3.x
@@ -35,11 +41,13 @@ jobs:
35
41
# since datajoint-python doesn't have platform specific dependencies or binaries,
36
42
# and the build process is fairly fast, so removed upload/download artifacts
37
43
- name : Build package
44
+ id : build
38
45
run : |
39
46
python -m pip install build
40
47
python -m build .
41
48
echo "DJ_WHEEL_PATH=$(ls dist/datajoint-*.whl)" >> $GITHUB_ENV
42
49
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
43
51
- name : Publish package
44
52
run : |
45
53
export HOST_UID=$(id -u)
@@ -55,48 +63,16 @@ jobs:
55
63
-e TWINE_PASSWORD=${TWINE_PASSWORD} \
56
64
-e TWINE_REPOSITORY=${TWINE_REPOSITORY} \
57
65
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
59
70
if : ${{ github.event.inputs.testpypi == 'false' }}
60
- uses : docker/login-action@v3
61
71
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
92
74
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 }}
100
76
# Upload package as release assets
101
77
- name : Upload pip wheel asset to release
102
78
if : ${{ github.event.inputs.testpypi == 'false' }}
@@ -118,10 +94,3 @@ jobs:
118
94
asset_path : ${{env.DJ_SDIST_PATH}}
119
95
asset_name : pip-datajoint-${{env.DJ_VERSION}}.tar.gz
120
96
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