-
Notifications
You must be signed in to change notification settings - Fork 549
62 lines (52 loc) · 1.75 KB
/
pull-request.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
name: Pull Request
on:
pull_request:
paths:
- '.github/workflows/**'
- 'src/**'
- 'pom.xml'
permissions:
contents: read
jobs:
setup-preview-build:
name: Preview build
runs-on: ubuntu-latest
outputs:
short-commit-hash: ${{ steps.env-setup.outputs.SHORT_COMMIT_HASH }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/[email protected]
with:
distribution: 'adopt'
java-version: '21'
java-package: jdk
architecture: x64
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
# Setup for the preview build
- id: env-setup
run: |
SHORT_COMMIT_HASH=$(git rev-parse --short=8 ${{ github.sha }})
JAR_VERSION="Preview Build #${{ github.event.number }}-$SHORT_COMMIT_HASH"
echo "SHORT_COMMIT_HASH=$SHORT_COMMIT_HASH" >> "$GITHUB_ENV"
echo "SHORT_COMMIT_HASH=$SHORT_COMMIT_HASH" >> "$GITHUB_OUTPUT"
echo "JAR_VERSION=$JAR_VERSION" >> "$GITHUB_ENV"
sed -i "s/<version>4.9-UNOFFICIAL<\/version>/<version>$JAR_VERSION<\/version>/g" pom.xml
- name: Build with Maven
run: mvn package
- name: Upload the artifact
uses: actions/upload-artifact@v4
with:
name: slimefun-${{ github.event.number }}-${{ env.SHORT_COMMIT_HASH }}
path: 'target/Slimefun v${{ env.JAR_VERSION }}.jar'
call-workflows:
needs: [setup-preview-build]
uses: ./.github/workflows/e2e-testing.yml
with:
artifact-name: slimefun-${{ github.event.number }}-${{ needs.setup-preview-build.outputs.short-commit-hash }}