Skip to content

Commit 21f8eed

Browse files
committed
[CI] Reorganize some CI tasks to dedupe workflows
1 parent d7c0f92 commit 21f8eed

File tree

5 files changed

+91
-131
lines changed

5 files changed

+91
-131
lines changed

.github/workflows/_announce-latest-build.yml

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -11,74 +11,8 @@ on:
1111
required: true
1212

1313
jobs:
14-
get-package-info:
15-
name: Get Latest Package Info
16-
runs-on: ubuntu-22.04
17-
outputs:
18-
version: ${{ steps.download-info.outputs.version }}
19-
jarFile: ${{ fromJson(steps.info.outputs.latestJson)[0].name }}
20-
mcVersion: ${{steps.minecraft.outputs.prop}}
21-
neoVersion: ${{steps.neoforge.outputs.prop}}
22-
23-
steps:
24-
- name: Checkout
25-
uses: actions/checkout@v4
26-
27-
- name: Set up JDK
28-
uses: actions/setup-java@v4
29-
with:
30-
distribution: temurin
31-
java-version: 21
32-
33-
- name: Setup Groovy
34-
uses: wtfjoke/setup-groovy@v2
35-
with:
36-
groovy-version: '4.x'
37-
38-
- name: Download Package Info
39-
id: download-info
40-
uses: compactmods/[email protected]
41-
env:
42-
GQL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43-
with:
44-
owner: compactmods
45-
repo: compactmachines
46-
group: dev.compactmods.compactmachines.compactmachines-neoforge
47-
filter: "^compactmachines-neoforge-(?:[\\d\\.]+).jar$"
48-
outputFile: compactmachines.json
49-
50-
- name: Debug output
51-
run: |
52-
echo "Version: ${{ steps.download-info.outputs.version }}"
53-
cat compactmachines.json
54-
55-
- name: Read info into variable [latest]
56-
id: info
57-
run: echo "latestJson=$(cat compactmachines.json)" >> $GITHUB_OUTPUT
58-
59-
- name: Download JAR and prepare artifacts
60-
run: |
61-
mkdir release
62-
curl -L "${{ fromJson(steps.info.outputs.latestJson)[0].url }}" -o "release/${{ fromJson(steps.info.outputs.latestJson)[0].name }}"
63-
mv compactmachines.json release/compactmachines.json
64-
65-
- name: MC Version
66-
id: minecraft
67-
run: groovy read-manifest.groovy release/${{ fromJson(steps.info.outputs.latestJson)[0].name }} "Minecraft-Version" >> "$GITHUB_OUTPUT"
68-
69-
- name: NeoForge Version
70-
id: neoforge
71-
run: groovy read-manifest.groovy release/${{ fromJson(steps.info.outputs.latestJson)[0].name }} "NeoForge-Version" >> "$GITHUB_OUTPUT"
72-
73-
- name: Add Artifact
74-
uses: actions/upload-artifact@v4
75-
with:
76-
name: release
77-
path: release
78-
7914
announce:
8015
name: Discord Announcement
81-
needs: [ get-package-info ]
8216
runs-on: ubuntu-22.04
8317
steps:
8418
- name: Grab JAR and Info
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Download Latest Package Info
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
inputs:
7+
diagnostic_mode:
8+
description: Diagnostic Mode
9+
type: boolean
10+
default: false
11+
required: true
12+
13+
jobs:
14+
get-package-info:
15+
name: Get Latest Package Info
16+
runs-on: ubuntu-22.04
17+
outputs:
18+
version: ${{ steps.download-info.outputs.version }}
19+
jarFile: ${{ fromJson(steps.info.outputs.latestJson)[0].name }}
20+
mcVersion: ${{steps.minecraft.outputs.prop}}
21+
neoVersion: ${{steps.neoforge.outputs.prop}}
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Set up JDK
28+
uses: actions/setup-java@v4
29+
with:
30+
distribution: temurin
31+
java-version: 21
32+
33+
- name: Setup Groovy
34+
uses: wtfjoke/setup-groovy@v2
35+
with:
36+
groovy-version: '4.x'
37+
38+
- name: Download Package Info
39+
id: download-info
40+
uses: compactmods/[email protected]
41+
env:
42+
GQL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
with:
44+
owner: compactmods
45+
repo: compactmachines
46+
group: dev.compactmods.compactmachines.compactmachines-neoforge
47+
filter: "^compactmachines-neoforge-(?:[\\d\\.]+).jar$"
48+
outputFile: compactmachines.json
49+
50+
- name: Debug output
51+
run: |
52+
echo "Version: ${{ steps.download-info.outputs.version }}"
53+
cat compactmachines.json
54+
55+
- name: Read info into variable [latest]
56+
id: info
57+
run: echo "latestJson=$(cat compactmachines.json)" >> $GITHUB_OUTPUT
58+
59+
- name: Download JAR and prepare artifacts
60+
run: |
61+
mkdir release
62+
curl -L "${{ fromJson(steps.info.outputs.latestJson)[0].url }}" -o "release/${{ fromJson(steps.info.outputs.latestJson)[0].name }}"
63+
mv compactmachines.json release/compactmachines.json
64+
65+
- name: MC Version
66+
id: minecraft
67+
run: groovy read-manifest.groovy release/${{ fromJson(steps.info.outputs.latestJson)[0].name }} "Minecraft-Version" >> "$GITHUB_OUTPUT"
68+
69+
- name: NeoForge Version
70+
id: neoforge
71+
run: groovy read-manifest.groovy release/${{ fromJson(steps.info.outputs.latestJson)[0].name }} "NeoForge-Version" >> "$GITHUB_OUTPUT"
72+
73+
- name: Add Artifact
74+
uses: actions/upload-artifact@v4
75+
with:
76+
name: release
77+
path: release

.github/workflows/_release-cf-alpha.yml

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,9 @@ name: Release Latest Build to CurseForge as Alpha
22

33
on: [workflow_dispatch, workflow_call]
44
jobs:
5-
get-package-info:
6-
name: Get Latest Package Info
7-
runs-on: ubuntu-22.04
8-
outputs:
9-
version: ${{ steps.download-info.outputs.version }}
10-
steps:
11-
- name: Download Package Info
12-
id: download-info
13-
uses: compactmods/[email protected]
14-
env:
15-
GQL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16-
with:
17-
owner: compactmods
18-
repo: compactmachines
19-
group: dev.compactmods.compactmachines.compactmachines-neoforge
20-
filter: "^compactmachines-neoforge-(?:[\\d\\.]+).jar$"
21-
outputFile: compactmachines.json
22-
23-
- name: Debug output
24-
run: |
25-
echo "Version: ${{ steps.download-info.outputs.version }}"
26-
cat compactmachines.json
27-
28-
- name: Read info into variable [latest]
29-
id: info
30-
run: echo "latestJson=$(cat compactmachines.json)" >> $GITHUB_OUTPUT
31-
32-
- name: Download JAR and prepare artifacts
33-
run: |
34-
mkdir release
35-
curl -L "${{ fromJson(steps.info.outputs.latestJson)[0].url }}" -o "release/${{ fromJson(steps.info.outputs.latestJson)[0].name}}"
36-
mv compactmachines.json release/compactmachines.json
37-
38-
- name: Add Artifact
39-
uses: actions/upload-artifact@v4
40-
with:
41-
name: release
42-
path: release
43-
445
release-cf:
456
name: Make Curseforge Release
46-
runs-on: ubuntu-20.04
47-
needs: [get-package-info]
7+
runs-on: ubuntu-22.04
488
steps:
499
- name: Grab JAR and Info
5010
uses: actions/download-artifact@v4

.github/workflows/announce-latest-build.yml

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,12 @@ on: workflow_dispatch
66

77
jobs:
88
get-package-info:
9-
name: Latest Package Info
10-
runs-on: ubuntu-22.04
11-
outputs:
12-
version: ${{ steps.download-info.outputs.version }}
13-
steps:
14-
- name: Download Package Info
15-
id: download-info
16-
uses: compactmods/[email protected]
17-
env:
18-
GQL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19-
with:
20-
owner: compactmods
21-
repo: compactmachines
22-
group: dev.compactmods.compactmachines.compactmachines-neoforge
23-
filter: "^compactmachines-neoforge-(?:[\\d\\.]+).jar$"
24-
outputFile: compactmachines.json
25-
26-
- name: Debug output
27-
run: |
28-
echo "Version: ${{ steps.download-info.outputs.version }}"
29-
cat compactmachines.json
9+
name: Get Package Info
10+
uses: ./.github/workflows/_download-latest-package-info.yml
11+
secrets: inherit
3012

3113
announce:
3214
name: Discord Announcement
15+
needs: [get-package-info]
3316
uses: ./.github/workflows/_announce-latest-build.yml
3417
secrets: inherit

.github/workflows/ci-builds.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
- "neoforge-datagen/**"
1414
- "neoforge-main/**"
1515
workflow_dispatch:
16-
16+
1717
jobs:
1818
vars:
1919
name: Get Variables
@@ -77,14 +77,20 @@ jobs:
7777
sha: context.sha
7878
})
7979
80+
get-package-info:
81+
name: Get Package Info
82+
needs: [ publish ]
83+
uses: ./.github/workflows/_download-latest-package-info.yml
84+
secrets: inherit
85+
8086
announce:
8187
name: Discord Announcement
82-
needs: [ publish ]
88+
needs: [ get-package-info ]
8389
uses: ./.github/workflows/_announce-latest-build.yml
8490
secrets: inherit
8591

8692
release-cf:
8793
name: Release Alpha on CurseForge
88-
needs: [ publish ]
94+
needs: [ get-package-info ]
8995
uses: ./.github/workflows/_release-cf-alpha.yml
9096
secrets: inherit

0 commit comments

Comments
 (0)