-
Notifications
You must be signed in to change notification settings - Fork 1
50 lines (50 loc) · 2.12 KB
/
build.yml
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
name: "build"
on:
push:
branches: "**"
tags-ignore: [ "**" ]
pull_request:
release:
types: [ released ]
jobs:
build:
strategy:
matrix:
java: [ "17" ]
os: [ "ubuntu-latest" ]
# Only run on PRs if the source branch is on someone else's repo
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
runs-on: "${{ matrix.os }}"
steps:
- name: "checkout repository"
uses: "actions/checkout@v3"
- name: "validate gradle wrapper"
uses: gradle/wrapper-validation-action@v1
- name: "setup jdk ${{ matrix.java }}"
uses: "actions/setup-java@v3"
with:
distribution: 'temurin'
java-version: "${{ matrix.java }}"
- name: "setup gradle"
uses: gradle/gradle-build-action@v2
- name: "build"
run: "./gradlew :plugin:build"
- name: "determine status"
run: |
if [ "$(./gradlew :plugin:properties | awk '/^version:/ { print $2; }' | grep '\-SNAPSHOT')" ]; then
echo "STATUS=snapshot" >> $GITHUB_ENV
else
echo "STATUS=release" >> $GITHUB_ENV
fi
- name: "publish snapshot"
if: "${{ env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/master' }}"
run: ./gradlew :plugin:publish
env:
ORG_GRADLE_PROJECT_paperUsername: "${{ secrets.PAPER_REPO_USERNAME }}"
ORG_GRADLE_PROJECT_paperPassword: "${{ secrets.PAPER_REPO_PASSWORD }}"
- name: "publish release"
if: "${{ env.STATUS == 'release' && github.event_name == 'release' }}"
run: ./gradlew :plugin:publishPlugins
env:
GRADLE_PUBLISH_KEY: "${{ secrets.GRADLE_PLUGIN_PORTAL_KEY }}"
GRADLE_PUBLISH_SECRET: "${{ secrets.GRADLE_PLUGIN_PORTAL_SECRET }}"