Skip to content

Commit e251dd6

Browse files
committed
Makefile: Refactor publish* targets to use GitHub CLI instead
1 parent 986ad83 commit e251dd6

1 file changed

Lines changed: 21 additions & 39 deletions

File tree

Makefile

Lines changed: 21 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@
1111
# - Target 'verify'
1212
# Requires OpenSSL and a RSA public key to verify the release archive at
1313
# '~/.nextcloud/certificates/$(app_name).pub'
14-
# - Targets 'github-release' and 'github-upload'
15-
# Requires https://github.com/aktau/github-release and a 'github-token'
16-
# file at '~/.nextcloud/github-token' with an GitHub API token, e.g.
17-
# deadbeefc001cafebaadf00dabad1deadeadcode
18-
# - Target 'publish'
14+
# - Targets 'publish-github'
15+
# Requires GitHub CLI with working authentication (see https://cli.github.com/)
16+
# - Target 'publish-appstore'
1917
# Requires a 'curlrc' file at '~/.nextcloud/curlrc' with an appropiate
2018
# Authentication header for the Nextcloud App Store, e.g.
2119
# header = "Authorization: Token [NEXTCLOUD_API_TOKEN]"
@@ -39,10 +37,7 @@ archive=$(app_name)-$(version).tar.gz
3937
export=$(app_name)-export.tar.gz
4038
signature=$(app_name)-$(version).tar.gz.sig
4139
git_remote=origin
42-
github_owner=nextcloud
43-
github_repo=cms_pico
44-
github_token:=$(shell [ -n "$$GITHUB_TOKEN" ] && echo "$$GITHUB_TOKEN" || cat "$(HOME)/.nextcloud/github-token")
45-
download_url=https://github.com/$(github_owner)/$(github_repo)/releases/download/$(version)/$(archive)
40+
download_url=https://github.com/nextcloud/cms_pico/releases/download/$(version)/$(archive)
4641
publish_url=https://apps.nextcloud.com/api/v1/apps/releases
4742
appinfo=./appinfo/info.xml
4843
appinfo_version:=$(shell sed -ne 's/^.*<version>\(.*\)<\/version>.*$$/v\1/p' "$(CURDIR)/$(appinfo)")
@@ -159,48 +154,35 @@ test:
159154
coverage: test
160155
$(php) -f ./vendor/bin/coverage -- ./tests/clover.xml 0
161156

162-
github-release: export GITHUB_TOKEN=$(github_token)
163-
github-release: check
164-
github-release release \
165-
--user "$(github_owner)" \
166-
--repo "$(github_repo)" \
167-
--tag "$(version)" \
168-
--name "$(version)" \
169-
--description "$(app_title) $(version)" \
170-
$(if $(filter true,$(prerelease)),--pre-release,)
171-
172-
github-upload: export GITHUB_TOKEN=$(github_token)
173-
github-upload: check check-composer build github-release
174-
github-release upload \
175-
--user "$(github_owner)" \
176-
--repo "$(github_repo)" \
177-
--tag "$(version)" \
178-
--name "$(archive)" \
179-
--file "$(build_dir)/$(archive)"
180-
181-
publish: check check-composer sign github-upload
182-
sleep 5
157+
publish-github: check check-composer build
158+
gh release create "$(version)" \
159+
--title "$(version)" \
160+
--notes "$(app_title) $(version)" \
161+
$(if $(filter true,$(prerelease)),--prerelease,) \
162+
"$(build_dir)/$(archive)"
163+
164+
publish-github-dev: prerelease=true
165+
publish-github-dev: publish-github
166+
167+
publish-appstore: check check-composer sign publish-github
183168
$(php) -r 'echo json_encode([ "download" => $$_SERVER["argv"][1], "signature" => file_get_contents($$_SERVER["argv"][2]), "nightly" => !!$$_SERVER["argv"][3] ]);' \
184169
"$(download_url)" "$(build_dir)/$(signature)" "$(if $(filter true,$(prerelease)),1,0)" \
185170
| curl -K "$(curlrc)" \
186171
-H "Content-Type: application/json" -d "@-" \
187172
-X POST "$(publish_url)"
188173

189-
github-release-dev: prerelease=true
190-
github-release-dev: github-release
191-
192-
github-upload-dev: prerelease=true
193-
github-upload-dev: github-upload
174+
publish-appstore-dev: prerelease=true
175+
publish-appstore-dev: publish-appstore
194176

195-
publish-dev: prerelease=true
196-
publish-dev: publish
177+
publish: publish-appstore
178+
publish-dev: publish-appstore-dev
197179

198180
.PHONY: all \
199181
clean clean-build clean-export \
200182
check check-composer lazy-check \
201183
composer build build-dev export \
202184
sign verify \
203185
test coverage \
204-
github-release github-release-dev \
205-
github-upload github-upload-dev \
186+
publish-github publish-github-dev \
187+
publish-appstore publish-appstore-dev \
206188
publish publish-dev

0 commit comments

Comments
 (0)