Skip to content

Commit 03dfd26

Browse files
committed
configure github actions
1 parent a9d36d7 commit 03dfd26

File tree

3 files changed

+114
-0
lines changed

3 files changed

+114
-0
lines changed

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "gradle"
4+
directory: "/" # Location of package manifests
5+
open-pull-requests-limit: 0
6+
schedule:
7+
interval: "daily"

.github/workflows/gradle.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Java CI with Gradle
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Set up JDK 8
17+
uses: actions/setup-java@v2
18+
with:
19+
distribution: 'temurin'
20+
java-version: '8'
21+
22+
- name: Cache multiple paths
23+
uses: actions/cache@v2
24+
with:
25+
path: |
26+
~/.gradle/caches
27+
./.gradle
28+
./buildSrc/build
29+
./build
30+
key: ${{ runner.os }}
31+
- name: Build with Gradle
32+
run: ./gradlew --stacktrace build
33+
- name: stop daemon
34+
run: ./gradlew --stop

.github/workflows/release.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Publisher
2+
"on":
3+
- workflow_dispatch
4+
jobs:
5+
build:
6+
environment: deployment
7+
runs-on: ubuntu-latest
8+
env:
9+
RELEASER_CHANGER: gradle-properties
10+
steps:
11+
- uses: actions/checkout@v2
12+
with:
13+
fetch-depth: 0
14+
token: "${{ secrets.ACTIONS_PAT }}"
15+
- name: Set up JDK 11
16+
uses: actions/setup-java@v2
17+
with:
18+
distribution: 'temurin'
19+
java-version: '8'
20+
- uses: anatawa12/something-releaser@v2
21+
22+
- run: set-git-user anatawa12-bot
23+
24+
- name: Update Version
25+
id: up
26+
run: |
27+
# set current version
28+
VERSION="$(get-version)"
29+
if ! [[ "$VERSION" = *-SNAPSHOT ]]; then
30+
echo 'VERSION IS NOT SNAPSHOT' >&2
31+
exit 1
32+
fi
33+
VERSION="$(version-unsnapshot "$VERSION")"
34+
set-version "$VERSION"
35+
# create changelog
36+
generate-changelog -v "$VERSION"
37+
# create changelog for this release
38+
RELEASE_NOTE="$(mktemp)"
39+
echo "::set-output name=RELEASE_NOTE::$RELEASE_NOTE"
40+
generate-changelog -v "$VERSION" --unreleased-only >> "$RELEASE_NOTE"
41+
# update versions in readme and example
42+
perl -pi \
43+
-e 's/(?<=\Q("com.anatawa12.compile-time-constant") version \E)".*"/"'$VERSION'"/' \
44+
README.md \
45+
example/build.gradle.kts
46+
# commit & tag
47+
git add .
48+
git commit -m "v$VERSION"
49+
git tag "v$VERSION"
50+
51+
- run: |
52+
./gradlew build
53+
git push && git push --tags
54+
- name: Create New Release
55+
env:
56+
GH_TOKEN: ${{ github.token }}
57+
RELEASE_NOTE: ${{ steps.up.outputs.RELEASE_NOTE }}
58+
run: |
59+
VERSION="$(get-version)"
60+
gh release create "v$VERSION" \
61+
--target "v$VERSION" \
62+
--notes-file "$RELEASE_NOTE"
63+
gh release upload "v$VERSION" \
64+
"build/libs/plugin-permissions-for-ngt-$VERSION.jar"
65+
66+
- name: Update To Next Version
67+
run: |
68+
VERSION="$(get-version)"
69+
VERSION="$(version-next "$VERSION")"
70+
set-version "$(version-snapshot "$VERSION")"
71+
git add .
72+
git commit -m "prepare for next version: $VERSION"
73+
git push

0 commit comments

Comments
 (0)