Skip to content

Commit 2db8384

Browse files
committed
test build workflow
1 parent ddd6c02 commit 2db8384

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

.github/workflows/test_build.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# This workflow will build and upload test artifact
2+
# Simple workflow with ignoring condition to prevent unneccessary build
3+
# To download artifact check on job task
4+
5+
name: Build Test Artifact
6+
7+
on:
8+
push:
9+
branches:
10+
- master
11+
paths-ignore:
12+
- '.github/**' # Release GHA file, please change this when you change the file name
13+
- 'LICENSE'
14+
- 'README.md'
15+
- '.editorconfig'
16+
workflow_dispatch:
17+
18+
jobs:
19+
build:
20+
name: Build and Upload Artifact
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout branch
25+
uses: actions/checkout@v4
26+
27+
# https://github.com/madhead/read-java-properties#error-java_home-is-set-to-an-invalid-directory
28+
- name: Gather Gradle properties
29+
uses: madhead/read-java-properties@latest
30+
id: gradle_properties
31+
with:
32+
file: gradle.properties
33+
all: true
34+
35+
- name: Retrieve SHA short
36+
id: vars
37+
shell: bash
38+
run: echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
39+
40+
- name: Change mod version
41+
run: sed -i "s/mod_version.*=.*/mod_version = ${{ steps.gradle_properties.outputs.mod_version }}-${{ steps.vars.outputs.SHA_SHORT }}/g" gradle.properties
42+
43+
- name: Set up Temurin JDK 8
44+
uses: actions/setup-java@v4
45+
with:
46+
distribution: 'temurin'
47+
java-version: '21'
48+
cache: gradle # Only cache stuff since test build action happen mostly
49+
50+
- name: Grant execute permission for gradlew
51+
run: chmod +x gradlew
52+
53+
- name: Setup Gradle
54+
uses: gradle/actions/setup-gradle@v3
55+
56+
- name: Build Project
57+
run: ./gradlew build
58+
59+
- name: Upload Build Artifacts
60+
uses: actions/upload-artifact@v4
61+
with:
62+
name: ModularUI-${{ steps.gradle_properties.outputs.modVersion }}-${{ github.run_number }}
63+
path: build/libs

0 commit comments

Comments
 (0)