-
Notifications
You must be signed in to change notification settings - Fork 1
59 lines (56 loc) · 1.62 KB
/
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
56
57
58
59
# This is the build workflow for GitHub Actions.
name: Build
on:
push:
pull_request:
push:
branches:
- "**"
workflow_call:
inputs:
ref:
required: false
type: string
permissions:
id-token: write
contents: read
attestations: write
actions: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout latest commit
if: ${{ inputs.ref == '' }}
uses: actions/[email protected]
- name: Checkout requested ref
if: ${{ inputs.ref != '' }}
uses: actions/[email protected]
with:
ref: ${{ inputs.ref }}
- uses: gradle/[email protected]
- name: Setup JDK 17
uses: actions/[email protected]
with:
java-version: 17
distribution: temurin
- name: Mark gradlew as an executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: Build
run: ./gradlew build
- name: Determine artifact name
id: name
run: |
BASE_NAME=$(awk -F '=' '/archives_base_name/ { print $2; }' gradle.properties)
VERSION=$(awk -F '=' '/mod_version/ { print $2; }' gradle.properties)
echo "name=$BASE_NAME-$VERSION.jar" >> $GITHUB_OUTPUT
- name: Generate artifact attestation
uses: actions/[email protected]
with:
subject-path: build/libs/${{ steps.name.outputs.name }}
- name: Upload artifact
uses: actions/[email protected]
with:
name: Artifacts
path: build/libs/${{ steps.name.outputs.name }}