-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (87 loc) · 3.16 KB
/
Copy pathrelease.yml
File metadata and controls
97 lines (87 loc) · 3.16 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Release
on:
push:
branches: [main]
concurrency:
group: release
cancel-in-progress: false
permissions:
contents: read
jobs:
verify:
name: Verify release
uses: ./.github/workflows/build.yml
release:
name: Cut release
needs: verify
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
revision: ${{ steps.version.outputs.revision }}
steps:
- name: Checkout
uses: actions/checkout@v7
# year.build, resetting the build number when the year changes.
- name: Bump version
id: version
run: |
CURRENT_YEAR="$(date +%y)"
CURRENT="$(sed -n 's|^version=||p' gradle.properties)"
YEAR="${CURRENT%%.*}"
BUILD="${CURRENT##*.}"
if [[ "$YEAR" != "$CURRENT_YEAR" ]]; then
YEAR="$CURRENT_YEAR"
BUILD=0
fi
BUILD=$((BUILD + 1))
REVISION="$YEAR.$BUILD"
sed -i "s|^version=.*|version=$REVISION|" gradle.properties
# Badge and the version users copy out of the install snippet.
sed -i \
-e "s|version-[^-]*-blue|version-$REVISION-blue|" \
-e "s|id(\"net.blueva.mawu\") version \"[^\"]*\"|id(\"net.blueva.mawu\") version \"$REVISION\"|" \
README.md
echo "revision=$REVISION" >> "$GITHUB_OUTPUT"
echo "Releasing Mawu $REVISION"
# Pushes made with GITHUB_TOKEN don't retrigger this workflow, so
# [skip ci] is just extra insurance.
- name: Commit version bump
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add gradle.properties README.md
git commit -m "build(release): bump version to ${{ steps.version.outputs.revision }} [skip ci]"
git push
- name: Tag release
run: |
git tag "v${{ steps.version.outputs.revision }}"
git push origin "v${{ steps.version.outputs.revision }}"
- name: Publish GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: gh release create "v${{ steps.version.outputs.revision }}" --title "Mawu ${{ steps.version.outputs.revision }}" --generate-notes
# A tag pushed with GITHUB_TOKEN does not start another workflow, so the
# release publishes rather than waiting for publish.yml to notice the tag.
publish:
name: Publish to repo.blueva.net
needs: release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
ref: v${{ needs.release.outputs.revision }}
- name: Set up JDK 17
uses: actions/setup-java@v6
with:
distribution: temurin
java-version: 17
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v6
- name: Publish the plugin and the runtime
run: ./gradlew publishAllPublicationsToBluevaRepoRepository --no-daemon --stacktrace
env:
RELEASE_VERSION: ${{ needs.release.outputs.revision }}
BLUEVA_REPO_USERNAME: ${{ secrets.BLUEVA_REPO_USERNAME }}
BLUEVA_REPO_SECRET: ${{ secrets.BLUEVA_REPO_SECRET }}