-
Notifications
You must be signed in to change notification settings - Fork 1
56 lines (50 loc) · 1.72 KB
/
publish.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
name: publish
on:
push:
branches:
- '**'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 21
- name: Determine previous commit
id: determine_previous_commit
run: |
if [ "${{ github.event.before }}" = "0000000000000000000000000000000000000000" ]; then
gitPrevHash=$(git rev-parse HEAD~1)
else
gitPrevHash=${{ github.event.before }}
fi
echo "GIT_PREVIOUS_COMMIT=$gitPrevHash" >> $GITHUB_ENV
- name: Check commit messages
id: check_commit_messages
run: |
commits=$(git log $GIT_PREVIOUS_COMMIT..${{ github.sha }} --pretty=format:'%s')
echo "Commits since last push:"
echo "$commits"
if echo "$commits" | grep -qE '^\[meta\]'; then
echo "Only meta commits present, skip publishing"
echo "run_publish=false" >> $GITHUB_ENV
else
echo "run_publish=true" >> $GITHUB_ENV
fi
- name: Build and publish to maven
if: env.run_publish == 'true'
uses: gradle/actions/setup-gradle@v3
with:
arguments: clean build publish curseforge modrinth --no-configuration-cache
env:
GIT_COMMIT: ${{ github.sha }}
GIT_PREVIOUS_COMMIT: $GIT_PREVIOUS_COMMIT
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}