-
Notifications
You must be signed in to change notification settings - Fork 2
47 lines (37 loc) · 1.38 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
name: Bump Patch and Publish (Gradle)
on:
push:
branches: [ master ]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Java and Gradle
uses: actions/setup-java@v1
with:
java-version: 17
- name: Fix gradlew permissions (optional)
run: chmod +x gradlew
- name: Get Commit Count
id: commit_count
uses: octokit/[email protected]
with:
route: GET /repos/:owner/:repo/branches/:branch
owner: ${{ github.repository_owner }}
repo: ${{ github.event.repository.name }}
branch: ${{ github.event.repository.default_branch }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Print Commit Count
run:
echo "Total number of commits in : $(( $(echo ${{ steps.commit_count.outputs.data.commit.commitCount.toString() }}) ))"
- name: Get Version Info with Specific Commits (using custom task)
# Pass numCommits from workflow to Gradle task as an environment variable
env:
GITHUB_COMMITS: ${{ github.event.commits.length }}
run: ./gradlew getVersion
- name: Publish
env:
MAVEN_USERNAME: ${{ secrets.USERNAME }} # Reference the secret\
MAVEN_PASSWORD: ${{ secrets.PASSWORD }} # Reference the secret\
run: ./gradlew publish -DskipTests