forked from jagrosh/MusicBot
-
Notifications
You must be signed in to change notification settings - Fork 1
100 lines (85 loc) · 2.71 KB
/
maven-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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Make Release
on:
push:
branches:
- jda5 # Adjust the branch name as needed
jobs:
build_jar:
name: Build Jar
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: 'jda5'
- name: Set short git commit SHA
id: vars
run: |
calculatedSha=$(git rev-parse --short ${{ github.sha }})
echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Set Version
uses: datamonsters/replace-action@v2
with:
files: 'pom.xml'
replacements: 'Snapshot=${{ github.sha }}'
- name: Build with Maven
run: mvn --batch-mode --update-snapshots verify
- name: Rename jar
run: mv target/*-All.jar JMusicBot-${{ env.COMMIT_SHORT_SHA }}.jar
- name: Upload jar
uses: actions/upload-artifact@v3
with:
name: jar
path: JMusicBot-${{ env.COMMIT_SHORT_SHA }}.jar
if-no-files-found: error
create_release:
name: Create Release
runs-on: ubuntu-latest
needs: build_jar
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: 'jda5'
fetch-depth: '0'
- name: Set short git commit SHA
id: vars
run: |
calculatedSha=$(git rev-parse --short ${{ github.sha }})
echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV
- name: Download a Build Artifact
uses: actions/[email protected]
with:
name: jar
path: .
- name: Show Artifacts
run: ls -R
- name: Get Pushed Commits
id: get_pushed_commits
run: |
commit_range="${{ github.event.before }}..${{ github.sha }}"
commits=$(git log --pretty=format:'%h: %s' $commit_range)
echo "commits=$commits" >> $GITHUB_ENV
- name: Create Release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ env.COMMIT_SHORT_SHA }}
name: Build ${{ env.COMMIT_SHORT_SHA }}
draft: false
prerelease: false
artifacts: "*.jar"
body: |
Commits:
${{ env.commits }}
---
### Setup
https://jmusicbot.com/setup
https://jmusicbot.com/config
# Download: [JMusicBot-${{ env.COMMIT_SHORT_SHA }}.jar](https://github.com/ErdbeerbaerLP/MusicBot/releases/download/${{ env.COMMIT_SHORT_SHA }}/JMusicBot-${{ env.COMMIT_SHORT_SHA }}.jar)