@@ -21,6 +21,7 @@ AUTHOR:=$(shell grep "MyName =" patoolib/configuration.py | cut -d '"' -f2)
21
21
APPNAME: =$(shell grep "AppName =" patoolib/configuration.py | cut -d '"' -f2)
22
22
ARCHIVE_SOURCE: =$(APPNAME ) -$(VERSION ) .tar.gz
23
23
ARCHIVE_WHEEL: =$(APPNAME ) -$(VERSION ) -py2.py3-none-any.whl
24
+ GITRELEASETAG: =$(VERSION )
24
25
GITUSER: =wummel
25
26
GITREPO: =$(APPNAME )
26
27
HOMEPAGE: =$(HOME ) /public_html/patool-webpage.git
@@ -87,23 +88,37 @@ upload: ## upload a new release to pypi
87
88
twine upload --config-file $(XDG_CONFIG_HOME ) /pypirc \
88
89
dist/$(ARCHIVE_SOURCE ) dist/$(ARCHIVE_WHEEL )
89
90
90
- .PHONY : hub
91
- hub : # # add and push a github release
91
+ # export GITHUB_TOKEN for the hub command
92
+ # Generate a fine grained access token with:
93
+ # - Restricted to this repository (patool)
94
+ # - Repository permission: Metadata -> Read (displayed as "Read access to metadata" in token view)
95
+ # - Repository permission: Contents -> Read and write (displayed as "Read and Write access to code" in token view)
96
+ # - Expiration in 90 days
97
+ # After token generation or renewal, copy the contents in the local .envrc file and run "direnv allow ."
98
+ .PHONY : hub hub-draft hub-publish
99
+ hub : hub-draft hub-publish # # make a github release
100
+ hub-draft : # # create a draft release
92
101
hub release create \
93
- -a dist/$(ARCHIVE_SOURCE ) \
94
- -a dist/$(ARCHIVE_WHEEL ) \
95
- -m " Release $( VERSION) " \
96
- upstream/$(VERSION )
102
+ --draft \
103
+ --attach dist/$(ARCHIVE_SOURCE ) \
104
+ --message " Release $( GITRELEASETAG) " \
105
+ " $( GITRELEASETAG) "
106
+ hub-publish : # # add the wheel file and publish the draft
107
+ hub release edit \
108
+ --draft=false \
109
+ --attach dist/$(ARCHIVE_WHEEL ) \
110
+ --message " " \
111
+ " $( GITRELEASETAG) "
97
112
98
113
# Make a new release by calling all the distinct steps in the correct order.
99
114
# Each step is a separate target so that it's easy to do this manually if
100
115
# anything screwed up.
101
116
.PHONY : release
102
117
release : distclean releasecheck # # release a new version of patool
103
- $(MAKE ) dist hub upload homepage github-issues
118
+ $(MAKE ) dist tag hub upload homepage github-issues
104
119
105
120
.PHONY : releasecheck
106
- releasecheck : checkgit checkchangelog lint test # # check that repo is ready for release
121
+ releasecheck : checkgit checkgitreleasetag checkchangelog lint test # # check that repo is ready for release
107
122
108
123
.PHONY : checkgit
109
124
checkgit : # # check that git changes are all committed on the main branch
@@ -120,11 +135,18 @@ checkgit: ## check that git changes are all committed on the main branch
120
135
false; \
121
136
fi
122
137
138
+ .PHONY : checkgitreleasetag
139
+ checkgitreleasetag : # # check release tag for git exists
140
+ @if [ -z " $( shell git tag -l -- $( GITRELEASETAG) ) " ]; then \
141
+ echo " ERROR: git tag \" $( GITRELEASETAG) \" does not exist, execute 'git tag -a $( GITRELEASETAG) -m \" $( GITRELEASETAG) \" '" ; \
142
+ false ; \
143
+ fi
144
+
123
145
.PHONY : github-issues
124
146
github-issues : # # close github issues mentioned in changelog
125
147
# github-changelog is a local tool which parses the changelog and automatically
126
148
# closes issues mentioned in the changelog entries.
127
- cd .. && github-changelog $(DRYRUN) $( GITUSER) $(GITREPO) patool.git/doc/changelog.txt
149
+ cd .. && github-changelog $(GITUSER) $(GITREPO) patool.git/doc/changelog.txt
128
150
129
151
130
152
# ########### Versioning ############
0 commit comments