Skip to content

Commit baf773e

Browse files
authored
CI Update (#128)
* Revert "Try releasing dev build using bot account" * Rewrite CI logic * Use ubuntu-24.04 --------- Signed-off-by: Hendrix-Shen <[email protected]>
1 parent cdafc60 commit baf773e

File tree

93 files changed

+583
-516
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+583
-516
lines changed

.github/workflows/CI.yml

Lines changed: 15 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -1,171 +1,39 @@
11
name: CI
2-
# release: <default> (release title)
3-
# dispatch (all): Manual release for $target_release_tag
4-
# dispatch (specified): Manual release for $target_release_tag (subproject: $target_subproject)
5-
run-name: |-
6-
${{ github.event_name == 'workflow_dispatch' && format('Manual release for {0}{1}', inputs.target_release_tag, inputs.target_subproject && format(' (subproject: {0})', inputs.target_subproject) || '') || '' }}
72
on:
83
push:
94
branches:
105
- 'dev/**'
11-
- 'exp/**'
126
paths:
137
- '**/*.gradle'
148
- '**/gradle.properties'
159
- '**/src/**'
1610
- '**/versions/**'
1711
- '.github/**'
12+
pull_request:
1813
release:
1914
types:
2015
- published
21-
pull_request:
22-
workflow_dispatch:
23-
inputs:
24-
target_subproject:
25-
description: |-
26-
The subproject name(s) of the specified Minecraft version to be released, seperated with ",".
27-
By default all subprojects will be released.
28-
type: string
29-
required: false
30-
default: ''
31-
target_release_tag:
32-
description: |-
33-
The tag of the release you want to append the artifact to.
34-
type: string
35-
required: true
16+
3617
jobs:
37-
show_action_parameters:
38-
runs-on: ubuntu-latest
39-
steps:
40-
- name: Show action parameters
41-
run: |
42-
cat <<EOF > $GITHUB_STEP_SUMMARY
43-
## Action Parameters
44-
- target_subproject: \`${{ inputs.target_subproject }}\`
45-
- target_release_tag: \`${{ inputs.target_release_tag }}\`
46-
EOF
47-
validate_target_subproject:
48-
runs-on: ubuntu-latest
49-
steps:
50-
- name: Checkout the sources
51-
uses: actions/checkout@v4
52-
with:
53-
fetch-depth: 0
54-
- name: Validate target subproject
55-
if: ${{ github.event_name == 'workflow_dispatch' }}
56-
# ubuntu-22.04 uses Python 3.10.6
57-
run: python3 .github/workflows/scripts/validate_subproject.py
58-
env:
59-
TARGET_SUBPROJECT: ${{ inputs.target_subproject }}
60-
# Ensure the input release tag is valid.
61-
validate_release:
62-
runs-on: ubuntu-latest
63-
steps:
64-
- name: Get github release information
65-
if: ${{ github.event_name == 'workflow_dispatch' }}
66-
uses: cardinalby/[email protected]
67-
env:
68-
GITHUB_TOKEN: ${{ github.token }}
69-
with:
70-
tag: ${{ inputs.target_release_tag }}
71-
prepare_build_info:
18+
prepare_action_info:
7219
if: ${{ !startsWith(github.event.ref, 'refs/tags/') }}
73-
runs-on: ubuntu-latest
74-
outputs:
75-
build_publish: ${{ steps.build_info.outputs.build_publish }}
76-
build_target_subprojects: ${{ steps.subprojects.outputs.subprojects }}
77-
build_version_type: ${{ steps.build_info.outputs.build_version_type }}
78-
publish_channel: ${{ steps.build_info.outputs.publish_channel }}
79-
publish_target_release_tag: ${{ steps.build_info.outputs.publish_target_release_tag }}
80-
steps:
81-
- name: Checkout the sources
82-
uses: actions/checkout@v4
83-
with:
84-
fetch-depth: 0
85-
- name: Determining build info
86-
id: build_info
87-
run: |
88-
if [ ${{ github.repository_owner }} != 'Hendrix-Shen' ]
89-
then
90-
build_publish=true
91-
build_version_type=FORK
92-
publish_channel=fork
93-
elif [ ${{ github.event_name }} == 'push' ]
94-
then
95-
build_publish=true
96-
build_version_type=BETA
97-
publish_channel=dev
98-
elif [ ${{ github.event_name }} == 'release' ]
99-
then
100-
build_publish=true
101-
build_version_type=RELEASE
102-
publish_channel=stable
103-
publish_target_release_tag=${{ github.event.ref }}
104-
elif [ ${{ github.event_name }} == 'pull_request' ]
105-
then
106-
build_publish=false
107-
build_version_type=PULL_REQUEST
108-
elif [ ${{ github.event_name }} == 'workflow_dispatch' ]
109-
then
110-
build_publish=true
111-
build_version_type=RELEASE
112-
publish_channel=stable
113-
publish_target_release_tag=${{ inputs.target_release_tag }}
114-
else
115-
echo Unknown github event name $GITHUB_EVENT_NAME
116-
exit 1
117-
fi
118-
119-
echo "build_publish=$build_publish" >> $GITHUB_OUTPUT
120-
echo "build_version_type=$build_version_type" >> $GITHUB_OUTPUT
121-
echo "publish_channel=$publish_channel" >> $GITHUB_OUTPUT
122-
echo "publish_target_release_tag=$publish_target_release_tag" >> $GITHUB_OUTPUT
123-
124-
cat <<EOF > $GITHUB_STEP_SUMMARY
125-
## Determining build info
126-
- build_publish: \`$build_publish\`
127-
- build_version_type: \`$build_version_type\`
128-
- publish_channel: \`$publish_channel\`
129-
- publish_target_release_tag: \`$publish_target_release_tag\`
130-
EOF
131-
- name: Determining subprojects
132-
id: subprojects
133-
run: python3 .github/workflows/scripts/determining_subproject.py
134-
env:
135-
TARGET_SUBPROJECT: ${{ github.event.inputs.target_subproject }}
136-
prepare_publish_info:
137-
if: ${{ needs.prepare_build_info.outputs.build_publish == 'true' }}
138-
runs-on: ubuntu-latest
139-
needs:
140-
- prepare_build_info
141-
outputs:
142-
publish_channel: ${{ needs.prepare_build_info.outputs.publish_channel }}
143-
publish_target_release_tag: ${{ needs.prepare_build_info.outputs.publish_target_release_tag }}
144-
steps:
145-
- name: Checkout the sources
146-
uses: actions/checkout@v4
147-
with:
148-
fetch-depth: 0
20+
uses: ./.github/workflows/prepare_action_info.yml
14921
build:
150-
if: ${{ contains(github.event.head_commit.message, '[build skip]') == false }}
151-
needs:
152-
- prepare_build_info
153-
- validate_target_subproject
154-
- validate_release
22+
if: ${{ !contains(github.event.head_commit.message, '[build skip]') }}
15523
uses: ./.github/workflows/build.yml
15624
secrets: inherit
25+
needs:
26+
- prepare_action_info
15727
with:
158-
build_publish: ${{ needs.prepare_build_info.outputs.build_publish }}
159-
build_version_type: ${{ needs.prepare_build_info.outputs.build_version_type }}
160-
target_subproject: ${{ needs.prepare_build_info.outputs.build_target_subprojects }}
28+
build_publish: ${{ fromJSON(needs.prepare_action_info.outputs.build_publish) }}
29+
build_version_type: ${{ needs.prepare_action_info.outputs.build_version_type }}
16130
publish:
162-
if: ${{ github.event_name != 'pull_request' }}
163-
needs:
164-
- build
165-
- prepare_publish_info
31+
if: ${{ fromJSON(needs.prepare_action_info.outputs.publish_enable) }}
16632
uses: ./.github/workflows/publish.yml
16733
secrets: inherit
34+
needs:
35+
- build
36+
- prepare_action_info
16837
with:
169-
publish_channel: ${{ needs.prepare_publish_info.outputs.publish_channel }}
170-
publish_target_release_tag: ${{ needs.prepare_publish_info.outputs.publish_target_release_tag }}
171-
target_subproject: ${{ inputs.target_subproject }}
38+
publish_platform_channel: ${{ needs.prepare_action_info.outputs.publish_platform_channel }}
39+
publish_type: ${{ needs.prepare_action_info.outputs.publish_type }}

.github/workflows/build.yml

Lines changed: 26 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,16 @@ on:
33
workflow_call:
44
inputs:
55
build_publish:
6-
type: string
7-
required: true
6+
type: boolean
7+
default: false
8+
required: false
89
build_version_type:
910
type: string
10-
required: true
11-
target_subproject:
12-
description: see CI.yml, leave it empty to build all
13-
type: string
11+
default: 'DEV'
1412
required: false
15-
default: ''
1613
jobs:
1714
build:
18-
runs-on: ubuntu-latest
15+
runs-on: ubuntu-24.04
1916
steps:
2017
- name: Checkout the sources
2118
uses: actions/checkout@v4
@@ -26,8 +23,9 @@ jobs:
2623
with:
2724
distribution: 'temurin'
2825
java-version: 21
26+
- name: Validate gradle wrapper
27+
uses: gradle/actions/wrapper-validation@v4
2928
- name: Cache gradle files
30-
if: ${{ inputs.build_version_type != 'PULL_REQUEST' }}
3129
uses: actions/cache@v4
3230
with:
3331
path: |
@@ -44,44 +42,35 @@ jobs:
4442
./gradlew preprocessResources
4543
env:
4644
BUILD_TYPE: ${{ inputs.build_version_type }}
47-
- name: Build with gradle
48-
run: |
49-
chmod +x gradlew
50-
if [ -z "${{ inputs.target_subproject }}" ]; then
51-
echo "Building all subprojects"
52-
./gradlew build
53-
else
54-
args=$(echo "${{ inputs.target_subproject }}" | tr ',' '\n' | sed 's/$/:build/' | paste -sd ' ')
55-
echo "Building with arguments=$args"
56-
./gradlew $args
57-
fi
58-
env:
59-
BUILD_TYPE: ${{ inputs.build_version_type }}
60-
- name: Publish with gradle
61-
if: ${{ inputs.build_publish == 'true' }}
45+
- name: Build and publish with gradle
46+
if: ${{ inputs.build_publish == true }}
6247
run: |
63-
if [ -z "${{ inputs.target_subproject }}" ]; then
64-
echo "Publishing all subprojects"
65-
./gradlew publish
66-
else
67-
args=$(echo "${{ inputs.target_subproject }}" | tr ',' '\n' | sed 's/$/:publish/' | paste -sd ' ')
68-
echo "Publishing with arguments=$args"
69-
./gradlew $args
70-
fi
48+
./gradlew build publish -x test --stacktrace
7149
env:
7250
BUILD_TYPE: ${{ inputs.build_version_type }}
7351
NYAN_MAVEN_PASSWORD: ${{ secrets.NYAN_MAVEN_PASSWORD }}
7452
NYAN_MAVEN_USERNAME: ${{ secrets.NYAN_MAVEN_USERNAME }}
7553
SIGNING_PGP_KEY: ${{ secrets.SIGNING_PGP_KEY }}
76-
- name: Upload artifacts
54+
- name: Build and publishToMavenLocal with gradle
55+
if: ${{ inputs.build_publish == false }}
56+
run: |
57+
./gradlew build publishToMavenLocal -x test --stacktrace
58+
env:
59+
BUILD_TYPE: ${{ inputs.build_version_type }}
60+
- name: Upload build artifacts
7761
uses: actions/upload-artifact@v4
7862
with:
7963
name: build-artifacts
8064
path: |
8165
*/**/build/libs/
8266
*/**/build/tmp/submods/
67+
- name: Upload MavenLocal
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: Maven Local
71+
path: ~/.m2/repository/top/hendrixshen/
8372
summary:
84-
runs-on: ubuntu-24.04
73+
runs-on: ubuntu-latest
8574
needs:
8675
- build
8776
steps:
@@ -95,7 +84,6 @@ jobs:
9584
name: build-artifacts
9685
path: build-artifacts
9786
- name: Make build summary
98-
# ubuntu-22.04 uses Python 3.10.6
99-
run: python3 .github/workflows/scripts/summary.py
100-
env:
101-
TARGET_SUBPROJECT: ${{ inputs.target_subproject }}
87+
run: |
88+
pip install jproperties
89+
python .github/workflows/scripts/summary.py

.github/workflows/generate_matrix.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
name: _step.generate_matrix
22
on:
33
workflow_call:
4-
inputs:
5-
target_subproject:
6-
description: see CI.yml, for generating matrix entries
7-
type: string
8-
required: false
9-
default: ''
104
outputs:
115
matrix:
126
description: The generated run matrix
@@ -21,9 +15,8 @@ jobs:
2115
fetch-depth: 0
2216
- name: Generate matrix
2317
id: generate_matrix
24-
# ubuntu-22.04 uses Python 3.10.6
25-
run: python3 .github/workflows/scripts/matrix.py
26-
env:
27-
TARGET_SUBPROJECT: ${{ inputs.target_subproject }}
18+
run: |
19+
pip install jproperties
20+
python .github/workflows/scripts/matrix.py
2821
outputs:
2922
matrix: ${{ steps.generate_matrix.outputs.matrix }}

.github/workflows/issues.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
workflow_dispatch:
66
jobs:
77
close-issues:
8-
runs-on: ubuntu-latest
8+
runs-on: ubuntu-24.04
99
permissions:
1010
issues: write
1111
steps:

0 commit comments

Comments
 (0)