-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
66 lines (57 loc) · 2.5 KB
/
Copy pathMakefile
File metadata and controls
66 lines (57 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
SHELL := /bin/bash
.DEFAULT_GOAL := build
.PHONY: clean
clean:
./gradlew clean
.PHONY: build
build:
./gradlew build publishToMavenLocal
.PHONY: build-ci
build-ci:
./gradlew check --build-cache --no-daemon
.PHONY: tag-if-release
# Tags the current `version.txt` value iff this push changed it. Multi-commit pushes are
# handled via $BEFORE_SHA (github.event.before) so the trigger isn't lost when the version
# bump is followed by further commits in the same push. version.txt is the release stream
# and never carries a SNAPSHOT suffix — snapshots live in snapshot-version.txt.
tag-if-release:
@VERSION=$$(cat version.txt); \
BEFORE=$${BEFORE_SHA:-}; \
if [[ -z "$$BEFORE" || "$$BEFORE" =~ ^0+$$ ]]; then \
echo "No previous commit available — skipping tag creation."; \
else \
git fetch --quiet --no-tags origin "$$BEFORE" --depth=1 2>/dev/null || true; \
if ! git diff --name-only "$$BEFORE" HEAD -- version.txt | grep -qx version.txt; then \
echo "version.txt unchanged in this push — skipping tag creation."; \
elif git ls-remote --exit-code --tags origin "refs/tags/$$VERSION" >/dev/null 2>&1; then \
echo "Tag $$VERSION already exists on remote — skipping."; \
else \
echo "version.txt bumped to $$VERSION — creating tag."; \
git config user.name github-actions; \
git config user.email github-actions@github.com; \
git remote set-url origin https://x-access-token:$(GH_TOKEN)@github.com/$${GITHUB_REPOSITORY}.git; \
git tag -a "$$VERSION" -m "Version $$VERSION"; \
git push origin "$$VERSION"; \
fi; \
fi
.PHONY: create-release-note
create-release-note:
@echo "Creating Release Note"
@echo "Changelog:" > RN.md
@sed -n "/^### v${GIT_TAG_NAME}[[:space:]]*.*$$/,/###/p" CHANGELOG.md | sed '1d' | sed '$$d' | sed '$$d' >> RN.md
.PHONY: publish-gradle-plugin
publish-gradle-plugin:
./gradlew --build-cache --no-daemon publishPlugins \
-PreleaseVersion="$${GIT_TAG_NAME}" \
-Pgradle.publish.key="$${GRADLE_PUBLISH_KEY}" \
-Pgradle.publish.secret="$${GRADLE_PUBLISH_SECRET}"
.PHONY: validate-gradle-plugin
validate-gradle-plugin:
./gradlew --build-cache --no-daemon publishPlugins --validate-only \
-PreleaseVersion="$${GIT_TAG_NAME}" \
-Pgradle.publish.key="$${GRADLE_PUBLISH_KEY}" \
-Pgradle.publish.secret="$${GRADLE_PUBLISH_SECRET}"
.PHONY: publish-to-sonatype-snapshot
publish-to-sonatype-snapshot:
./gradlew --build-cache --no-daemon publish -PreleaseVersion="$${RELEASE_VERSION}"
./gradlew --build-cache --no-daemon jreleaserDeploy -PreleaseVersion="$${RELEASE_VERSION}"