-
-
Notifications
You must be signed in to change notification settings - Fork 31
55 lines (47 loc) · 1.73 KB
/
nightly-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
51
52
53
54
55
name: Publish Nightly
on:
workflow_dispatch:
schedule:
- cron: "0 3 * * *"
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Check if automatic run should exit early
if: github.event_name == 'schedule'
run: |
if [[ "$(git log --since='24 hours ago' | wc -l)" -eq 0 ]] ||
[[ "$(curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-s https://api.github.com/repos/${{ github.repository }}/actions/workflows \
| jq '.workflow_runs[] | select(.event == "workflow_dispatch") | .created_at' \
| grep -c "$(date -u +%F)" )" -gt 0 ]]; then
echo "Skipping automatic run"
exit 78
fi
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Set Gradle Perms
run: chmod +x gradlew
- name: Set nightly version
run: ./gradlew setNightlyVersion
- name: Publish package
run: ./gradlew publish -Pnightly=true --info
env:
MAVEN_USER: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASS: ${{ secrets.MAVEN_PASSWORD }}
- name: Create Discord Embed
run: ./gradlew injectDiscordEmbed -Pnightly=true
- name: Send Discord Webhook
run: |
curl -H "Content-Type: application/json" -d @./build/nightly_embed.json ${{ secrets.DISCORD_NIGHTLY_WEBHOOK }}