forked from kettingpowered/Ketting-1-20-x
-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (82 loc) · 2.59 KB
/
build_and_release.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
name: Server builds
on:
push:
branches:
- '*'
#todo: not sure if tags for ketting should be built.
# it might be better to just build all commits to the main branch
# and automatically push a tag and release.
tags:
- '*'
pull_request:
branches:
- '*'
workflow_dispatch:
#This permission is needed to push a release (and/or tags)
permissions:
contents: write
jobs:
#fixme: this is not ready yet, because the project itself doesn't compile.
create-release:
needs: build
if: ${{ github.ref == 'refs/heads/1.20.x' }}
runs-on: ubuntu-latest
steps:
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Rename and move artifacts
run: |
for dir in artifacts/*/
do
dir=${dir%*/} # remove the trailing "/"
for file in $dir/*
do
file=${file##*/} # remove the path before the filename
base=${file%.*} # remove the extension
ext=${file#"$base"} # remove the filename before the extension
echo "moving ${dir}/${file} to artifacts/${file%%.*}-${dir##*/}${ext}"
mv "${dir}/${file}" "artifacts/${file%%.*}-${dir##*/}${ext}"
done
rm -r "${dir}"
done
- name: release
uses: ncipollo/release-action@v1
id: create_release
with:
generateReleaseNotes: true
artifacts: "artifacts/*"
tag: ${{ github.sha }}
#prerelease: true
draft: true
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Java 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Cache .gradle
uses: burrunan/gradle-cache-action@v1
with:
# Enable concurrent cache save and restore
# Default is concurrent=false for better log readability
concurrent: true
# Disable caching of $HOME/.gradle/caches/*.*/generated-gradle-jars
save-generated-gradle-jars: false
# Disable publishing Gradle Build Scan URL to job report
gradle-build-scan-report: false
- name: Setup Ketting
run: ./gradlew setup
- name: Build Ketting Jar
run: ./gradlew kettingJar
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.name }}
path: |
projects/forge/build/libs/