Skip to content

Commit acc86c6

Browse files
committed
CI: Create workflow
1 parent e66ee53 commit acc86c6

1 file changed

Lines changed: 71 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: CI/CD
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- multiloader
8+
pull_request:
9+
branches:
10+
- main
11+
- multiloader
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout repo
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Setup JDK 21
24+
uses: actions/setup-java@v4
25+
with:
26+
java-version: '21'
27+
distribution: 'temurin'
28+
cache: 'gradle'
29+
30+
- name: Get commit SHA
31+
id: commit_sha
32+
run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
33+
34+
- name: Read current version from gradle.properties
35+
id: get_version
36+
run: |
37+
version=$(grep -A 1 "# GH_WORKFLOW::VERSION" gradle.properties | grep -oP '(?<=version=).*')
38+
echo "current_version=$version" >> $GITHUB_OUTPUT
39+
40+
- name: Set dynamic version
41+
id: set_version
42+
run: |
43+
DYNAMIC_VERSION="${{ steps.get_version.outputs.current_version }}-${{ steps.commit_sha.outputs.sha }}"
44+
echo "Dynamic version: $DYNAMIC_VERSION"
45+
echo "new_version=$DYNAMIC_VERSION" >> $GITHUB_OUTPUT
46+
47+
- name: Update gradle.properties
48+
run: |
49+
sed -i "s/^version=.*/version=${{ steps.set_version.outputs.new_version }}/" gradle.properties
50+
cat gradle.properties
51+
52+
- name: Build
53+
run: ./gradlew build
54+
55+
- name: Upload artifacts (Fabric)
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: "mismatched-chests-fabric"
59+
path: "./fabric/build/libs/mismatched_chests-fabric-1.21-${{ steps.set_version.outputs.new_version }}*.jar"
60+
61+
- name: Upload artifacts (Neoforge)
62+
uses: actions/upload-artifact@v4
63+
with:
64+
name: "mismatched-chests-neoforge"
65+
path: "./neoforge/build/libs/mismatched_chests-neoforge-1.21-${{ steps.set_version.outputs.new_version }}*.jar"
66+
67+
- name: Upload artifacts (Forge)
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: "mismatched-chests-forge"
71+
path: "./forge/build/libs/Mismatched Chests-forge-1.21-${{ steps.set_version.outputs.new_version }}*.jar"

0 commit comments

Comments
 (0)