Skip to content

Commit 940bd33

Browse files
authored
Update new build (#86)
1 parent 5e0c766 commit 940bd33

10 files changed

Lines changed: 1350 additions & 353 deletions

.github/workflows/auto-build.yml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,29 @@ jobs:
1515
- name: Checkout
1616
uses: actions/checkout@v3
1717

18-
- name: Set up JDK 8
18+
- name: Set up JDK 17
1919
uses: actions/setup-java@v3
2020
with:
21-
java-version: 8
21+
java-version: 17
2222
distribution: zulu
23-
cache: gradle
2423

2524
- name: Validate Gradle wrapper
2625
uses: gradle/wrapper-validation-action@v1
2726

2827
- name: Build with Gradle
2928
uses: gradle/gradle-build-action@v2
3029
with:
31-
arguments: build --scan --no-daemon
30+
arguments: 'build --build-cache --daemon' # use the daemon here so the rest of the process is faster
3231
generate-job-summary: true
32+
gradle-home-cache-includes: |
33+
caches
34+
jdks
35+
notifications
36+
wrapper
3337
34-
- name: Upload Jars
35-
uses: actions/upload-artifact@v3
38+
- name: Publish to GitHub
39+
uses: softprops/action-gh-release@v1
3640
with:
37-
name: GTExpert-Core
38-
path: build/libs/*.jar
41+
files: "build/libs/*.jar"
42+
generate_release_notes: true
43+
fail_on_unmatched_files: true

.github/workflows/publish.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Publishes built jars to distribution platforms
2+
name: Publish
3+
4+
on:
5+
push:
6+
tags:
7+
- 'v[0-9]+.[0-9]+.[0-9]+' # any semver tag, e.g. v1.2.3
8+
9+
env:
10+
# link to the changelog with a format code for the version
11+
CHANGELOG_LOCATION: "Changelog is available [here](https://github.com/${{github.repository}}/releases/tag/${{github.ref_name}})"
12+
# type of release
13+
RELEASE_TYPE: "beta"
14+
15+
jobs:
16+
Publish:
17+
runs-on: ubuntu-latest
18+
19+
permissions:
20+
contents: write # needed to create GitHub releases
21+
22+
steps:
23+
- name: Checkout Repository
24+
uses: actions/checkout@v3
25+
26+
- name: Check for Duplicate Tags
27+
run: |
28+
if git rev-parse -q --verify "refs/tags/${{ github.ref }}" >/dev/null; then
29+
echo "Tag already exists. A version bump is required."
30+
exit 1
31+
fi
32+
33+
- name: Setup Java
34+
uses: actions/setup-java@v3
35+
with:
36+
distribution: zulu
37+
java-version: 17
38+
39+
- name: Build Project
40+
uses: gradle/gradle-build-action@v2
41+
with:
42+
arguments: 'build --build-cache --daemon' # use the daemon here so the rest of the process is faster
43+
generate-job-summary: false
44+
gradle-home-cache-includes: |
45+
caches
46+
jdks
47+
notifications
48+
wrapper
49+
50+
- name: Publish to GitHub
51+
uses: softprops/action-gh-release@v1
52+
with:
53+
files: "build/libs/*.jar"
54+
generate_release_notes: true
55+
fail_on_unmatched_files: true
56+
57+
- name: Publish to Curseforge
58+
uses: gradle/gradle-build-action@v2
59+
env:
60+
CURSEFORGE_API_KEY: "${{secrets.CURSEFORGE_API_KEY}}"
61+
CURSEFORGE_PROJECT_ID: "${{secrets.CURSEFORGE_PROJECT_ID}}"
62+
CHANGELOG_LOCATION: "${{env.CHANGELOG_LOCATION}}"
63+
RELEASE_TYPE: "${{env.RELEASE_TYPE}}"
64+
with:
65+
arguments: 'curseforge --daemon'
66+
generate-job-summary: false
67+
gradle-home-cache-includes: |
68+
caches
69+
jdks
70+
notifications
71+
wrapper

.github/workflows/release.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Checks daily to see if the buildscript is in need of an update
2+
name: Buildscript Updating
3+
4+
on:
5+
workflow_dispatch:
6+
schedule:
7+
- cron: "0 0 * * *" # "min hr day month year", so run once per day
8+
9+
jobs:
10+
buildscript-update:
11+
runs-on: ubuntu-latest
12+
# Avoid running this workflow on forks
13+
if: github.repository == 'GregTechCEu/GregTech'
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v3
20+
21+
- name: Ensure build script version is up to date
22+
id: update-buildscript
23+
run: |
24+
curl https://raw.githubusercontent.com/GregTechCEu/Buildscripts/master/build.gradle --output build.gradle
25+
new_version=$(head -1 build.gradle | sed -r 's|//version: (.*)|\1|g')
26+
echo "NEW_VERSION=$new_version" >> "$GITHUB_OUTPUT"
27+
28+
- name: Create Pull Request
29+
id: create-pull-request
30+
uses: peter-evans/create-pull-request@v4
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.BUILDSCRIPT_UPDATER_TOKEN }}
33+
with:
34+
token: ${{ secrets.BUILDSCRIPT_UPDATER_TOKEN }}
35+
committer: GitHub <noreply@github.com>
36+
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
37+
add-paths: build.gradle
38+
commit-message: 'update build script version to ${{ steps.update-buildscript.outputs.NEW_VERSION }}'
39+
branch: gha-update-buildscript
40+
title: Update build script version to ${{ steps.update-buildscript.outputs.NEW_VERSION }}
41+
body: This pull request is created by the buildscript-update workflow
42+
labels: ignore changelog

addon.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
gradleEnterprise {
2+
buildScan {
3+
termsOfServiceUrl = "https://gradle.com/terms-of-service"
4+
termsOfServiceAgree = "yes"
5+
}
6+
}

0 commit comments

Comments
 (0)