generated from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix parallel release causing CI failure (#147)
Signed-off-by: Hendrix-Shen <[email protected]>
- Loading branch information
1 parent
012a153
commit 55ae6f8
Showing
1 changed file
with
65 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,16 +11,23 @@ on: | |
jobs: | ||
generate_matrix: | ||
uses: ./.github/workflows/generate_matrix.yml | ||
release: | ||
create_github_release: | ||
runs-on: ubuntu-24.04 | ||
strategy: | ||
matrix: ${{ fromJSON(needs.generate_matrix.outputs.matrix) }} | ||
needs: | ||
- generate_matrix | ||
# Allow the mod publish step to add assets to release | ||
# https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token | ||
permissions: | ||
contents: write | ||
outputs: | ||
commit_count: ${{ steps.shared_publish_info.outputs.commit_count }} | ||
github_changelog: ${{ steps.changelog.outputs.result }} | ||
github_tag: ${{ steps.shared_publish_info.outputs.github_tag }} | ||
mod_name: ${{ steps.shared_publish_info.outputs.mod_name }} | ||
mod_version: ${{ steps.shared_publish_info.outputs.mod_version }} | ||
mod_full_version: ${{ steps.shared_publish_info.outputs.mod_version }} | ||
release_title: ${{ steps.shared_publish_info.outputs.release_title }} | ||
short_sha: ${{ steps.shared_publish_info.outputs.short_sha }} | ||
steps: | ||
- name: Checkout the sources | ||
uses: actions/checkout@v4 | ||
|
@@ -78,14 +85,6 @@ jobs: | |
echo "mod_version=$mod_version" >> $GITHUB_OUTPUT | ||
echo "mod_full_version=$mod_full_version" >> $GITHUB_OUTPUT | ||
echo "release_title=$release_title" >> $GITHUB_OUTPUT | ||
- name: Get publish info | ||
id: publish_info | ||
run: | | ||
pip install jproperties | ||
python .github/workflows/scripts/publish_info.py | ||
env: | ||
MOD_PLATFORM: ${{ matrix.platform }} | ||
MOD_MC_VER: ${{ matrix.mc_ver }} | ||
- name: Prepare changelog | ||
uses: actions/github-script@v7 | ||
id: changelog | ||
|
@@ -106,11 +105,57 @@ jobs: | |
Latest commit log: | ||
${{ github.event.head_commit.message }} | ||
- name: Publish Minecraft Mods (Dev Channel) | ||
if: ${{ inputs.publish_type == 'dev' }} | ||
uses: Kir-Antipov/[email protected] | ||
with: | ||
github-tag: ${{ steps.shared_publish_info.outputs.github_tag }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
github-changelog: ${{ steps.changelog.outputs.result }} | ||
github-prerelease: true | ||
files: build-artifacts/versions/**/build/libs/!(*-@(dev|sources|javadoc)).jar | ||
name: ${{ steps.shared_publish_info.outputs.release_title }} | ||
retry-attempts: 3 | ||
retry-delay: 10000 | ||
- name: Publish Minecraft Mods (Stable Channel) | ||
if: ${{ inputs.publish_channel == 'stable' }} | ||
uses: Kir-Antipov/[email protected] | ||
with: | ||
github-tag: ${{ steps.shared_publish_info.outputs.github_tag }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
files: build-artifacts/versions/**/build/libs/!(*-@(dev|sources|javadoc)).jar | ||
retry-attempts: 3 | ||
retry-delay: 10000 | ||
create_platform_release: | ||
runs-on: ubuntu-24.04 | ||
strategy: | ||
matrix: ${{ fromJSON(needs.generate_matrix.outputs.matrix) }} | ||
needs: | ||
- generate_matrix | ||
- create_github_release | ||
steps: | ||
- name: Checkout the sources | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Download build artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: build-artifacts | ||
path: build-artifacts | ||
- name: Get publish info | ||
id: publish_info | ||
run: | | ||
pip install jproperties | ||
python .github/workflows/scripts/publish_info.py | ||
env: | ||
MOD_PLATFORM: ${{ matrix.platform }} | ||
MOD_MC_VER: ${{ matrix.mc_ver }} | ||
- name: Prepare file information | ||
id: file_info | ||
run: | | ||
shopt -s extglob | ||
FILE_PATHS=$(ls ${{ format('build-artifacts/versions//{0}-{1}/build/libs/!(*-@(dev|sources|javadoc)).jar', matrix.mc_ver, matrix.platform) }}) | ||
FILE_PATHS=$(ls ${{ format('build-artifacts/versions/{0}-{1}/build/libs/!(*-@(dev|sources|javadoc)).jar', matrix.mc_ver, matrix.platform) }}) | ||
if (( ${#FILE_PATHS[@]} != 1 )); then | ||
echo "Error: Found ${#FILE_PATHS[@]} files, expected exactly 1" | ||
|
@@ -127,13 +172,13 @@ jobs: | |
cat $GITHUB_OUTPUT | ||
- name: Attach file info to changelog | ||
uses: actions/github-script@v7 | ||
id: changelog_platform | ||
id: changelog | ||
with: | ||
script: return process.env.CHANGELOG | ||
result-encoding: string | ||
env: | ||
CHANGELOG: |- | ||
${{ steps.changelog.outputs.result }} | ||
${{ needs.release_core.outputs.github_changelog }} | ||
------- | ||
|
@@ -150,17 +195,10 @@ jobs: | |
modrinth-token: ${{ secrets.MODRINTH || '${undefined}' }} | ||
curseforge-id: '${undefined}' | ||
curseforge-token: ${{ secrets.CF_API_TOKEN || '${undefined}' }} | ||
github-tag: ${{ steps.shared_publish_info.outputs.github_tag }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
github-changelog: ${{ steps.changelog.outputs.result }} | ||
github-prerelease: true | ||
files: ${{ steps.file_info.outputs.path }} | ||
curseforge-changelog: ${{ steps.changelog_platform.outputs.result }} | ||
curseforge-name: ${{ steps.shared_publish_info.outputs.release_title }} | ||
modrinth-changelog: ${{ steps.changelog_platform.outputs.result }} | ||
modrinth-name: ${{ steps.shared_publish_info.outputs.release_title }} | ||
name: ${{ steps.shared_publish_info.outputs.release_title }} | ||
version: ${{ format('v{0}.{1}-mc{2}-{3}', steps.shared_publish_info.outputs.mod_version, steps.shared_publish_info.outputs.commit_count, matrix.mc_ver, matrix.platform) }} | ||
changelog: ${{ steps.changelog.outputs.result }} | ||
name: ${{ needs.create_github_release.outputs.release_title }} | ||
version: ${{ format('v{0}.{1}-mc{2}-{3}', needs.create_github_release.outputs.mod_version, needs.create_github_release.outputs.commit_count, matrix.mc_ver, matrix.platform) }} | ||
version-type: alpha | ||
loaders: ${{ steps.publish_info.outputs.publish_loaders }} | ||
game-versions: ${{ steps.publish_info.outputs.publish_game_versions }} | ||
|
@@ -176,15 +214,10 @@ jobs: | |
modrinth-token: ${{ secrets.MODRINTH || '${undefined}' }} | ||
curseforge-id: 525510 | ||
curseforge-token: ${{ secrets.CF_API_TOKEN || '${undefined}' }} | ||
github-tag: ${{ steps.shared_publish_info.outputs.github_tag }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
files: ${{ steps.file_info.outputs.path }} | ||
curseforge-changelog: ${{ steps.changelog_platform.outputs.result }} | ||
curseforge-name: ${{ steps.shared_publish_info.outputs.release_title }} | ||
modrinth-changelog: ${{ steps.changelog_platform.outputs.result }} | ||
modrinth-name: ${{ steps.shared_publish_info.outputs.release_title }} | ||
name: ${{ steps.shared_publish_info.outputs.release_title }} | ||
version: ${{ format('v{0}.{1}-mc{2}-{3}', steps.shared_publish_info.outputs.mod_version, steps.shared_publish_info.outputs.commit_count, matrix.mc_ver, matrix.platform) }} | ||
changelog: ${{ steps.changelog.outputs.result }} | ||
name: ${{ needs.create_github_release.outputs.release_title }} | ||
version: ${{ format('v{0}.{1}-mc{2}-{3}', needs.create_github_release.outputs.mod_version, needs.create_github_release.outputs.commit_count, matrix.mc_ver, matrix.platform) }} | ||
version-type: ${{ github.event.release.prerelease && 'beta' || 'release' }} | ||
loaders: ${{ steps.publish_info.outputs.publish_loaders }} | ||
game-versions: ${{ steps.publish_info.outputs.publish_game_versions }} | ||
|