-
-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (64 loc) · 2.77 KB
/
gradle.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#
# CI build that assembles artifacts and runs tests.
# If validation is successful this workflow releases from the main dev branch.
#
# - skipping CI: add [skip ci] to the commit message
# - skipping release: add [skip release] to the commit message
#
name: CI
permissions: read-all
on:
push:
branches: ['main']
tags-ignore: [v*] # release tags are autogenerated after a successful CI, no need to run CI against them
pull_request:
branches: ['**']
jobs:
gradle_wrapper_validation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 # docs: https://github.com/actions/checkout
with:
fetch-depth: '0' # https://github.com/shipkit/shipkit-auto-version#fetch-depth-on-ci
- name: Gradle wrapper validation
uses: gradle/wrapper-validation-action@8a2cbc9ccf0390177c07106bbfb02746e8f0413b # v2.1.0
build:
runs-on: ubuntu-latest
needs: [ gradle_wrapper_validation ]
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 # https://github.com/actions/checkout
with:
fetch-depth: '0' # https://github.com/shipkit/shipkit-changelog#fetch-depth-on-ci
- name: Setup Java
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4
with:
distribution: adopt
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@aff52e5be96935327d77c5529075184377dc4371 # v3
- name: Perform Build via Gradle
run: ./gradlew build --scan
- name: Publish to Maven Local via Gradle
run: ./gradlew publishToMavenLocal --scan
- name: Upload CodeCov Report
uses: codecov/codecov-action@ab904c41d6ece82784817410c45d8b8c02684457 # v3
with:
files: "**/build/reports/jacoco/**/*.xml"
- name: Publish Plugin and Create GitHub Release via Gradle
# Release job, only for pushes to the main development branch
if: github.event_name == 'push'
&& github.ref == 'refs/heads/main'
&& github.repository == 'MythicDrops/mythicdrops-gradle-plugin'
&& !contains(toJSON(github.event.commits.*.message), '[skip release]')
run: ./gradlew publishPlugins githubRelease --scan
env:
# Gradle env variables docs: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_environment_variables
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }}
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}