|
1 | | -# This is a basic workflow to help you get started with Actions |
2 | | - |
3 | 1 | name: Build Release |
4 | 2 |
|
5 | | -# Controls when the action will run. Triggers the workflow on push or pull request |
6 | | -# events but only for the master branch |
| 3 | +# Controls when the action will run. |
| 4 | +# Releases should be created manually by running this workflow. |
7 | 5 | on: |
8 | | - release: |
9 | | - types: [created] |
10 | 6 | workflow_dispatch: |
11 | 7 |
|
12 | 8 | jobs: |
13 | | - # This workflow contains a single job called "build" |
14 | 9 | build: |
15 | | - # The type of runner that the job will run on |
16 | 10 | runs-on: ubuntu-latest |
17 | | - # Steps represent a sequence of tasks that will be executed as part of the job |
18 | 11 | steps: |
19 | | - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
20 | 12 | - uses: actions/checkout@v4 |
21 | 13 | - name: Set up JDK 21 |
22 | 14 | uses: actions/setup-java@v4 |
23 | 15 | with: |
24 | 16 | distribution: 'microsoft' |
25 | 17 | java-version: '21' |
26 | 18 |
|
27 | | - - name: Grant execute permission for gradlew |
28 | | - run: chmod +x gradlew |
29 | | - |
| 19 | + - name: Setup Gradle |
| 20 | + uses: gradle/actions/setup-gradle@v4 |
30 | 21 | - name: Build with Gradle |
31 | 22 | run: ./gradlew build |
32 | 23 |
|
| 24 | + - name: Process artifacts |
| 25 | + uses: actions/github-script@v7 |
| 26 | + id: fname |
| 27 | + with: |
| 28 | + result-encoding: string |
| 29 | + script: | |
| 30 | + const fs = require("fs") |
| 31 | + return fs.readdirSync("build/libs/").filter(e => !e.endsWith("dev.jar") && !e.endsWith("sources.jar") && e.endsWith(".jar"))[0].replace(".jar", ""); |
| 32 | +
|
33 | 33 | - uses: actions/upload-artifact@v4 |
34 | 34 | with: |
35 | | - name: Artifacts |
| 35 | + name: ${{ steps.fname.outputs.result }} |
36 | 36 | path: build/libs/ |
37 | 37 |
|
38 | 38 | - name: Read Changelog |
@@ -70,26 +70,13 @@ jobs: |
70 | 70 | echo "${delimiter}" |
71 | 71 | } >> $GITHUB_OUTPUT |
72 | 72 |
|
73 | | - - uses: actions/github-script@v7 |
74 | | - id: fname |
75 | | - with: |
76 | | - result-encoding: string |
77 | | - script: | |
78 | | - const fs = require("fs") |
79 | | - return fs.readdirSync("build/libs/").filter(e => !e.endsWith("dev.jar") && !e.endsWith("sources.jar") && e.endsWith(".jar"))[0] |
80 | | -
|
81 | | - - name: Release |
82 | | - id: uploadrelease |
83 | | - uses: softprops/action-gh-release@v1 |
84 | | - with: |
85 | | - body: ${{ steps.read_changelog.outputs.changelog }} |
86 | | - token: ${{ secrets.GH_RELEASE }} |
87 | | - files: build/libs/${{ steps.fname.outputs.result }} |
88 | | - |
89 | 73 | - name: Publish using mod-publish-plugin |
90 | 74 | run: ./gradlew build publishMods |
91 | 75 | env: |
92 | | - CHANGELOG: ${{ steps.read_changelog.outputs.changelog_highlight }} |
| 76 | + CHANGELOG: ${{ steps.read_changelog.outputs.changelog }} |
| 77 | + CHANGELOG_HIGHLIGHT: ${{ steps.read_changelog.outputs.changelog_highlight }} |
| 78 | + REF_NAME: ${{ github.ref_name }} |
| 79 | + GITHUB_TOKEN: ${{ secrets.GH_RELEASE }} |
93 | 80 | DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} |
94 | 81 | MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} |
95 | 82 | CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }} |
|
0 commit comments