Skip to content

Commit

Permalink
Merge branch 'master' into 25w03a
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander01998 committed Jan 22, 2025
2 parents 9499b34 + d95e86f commit 68e057c
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 20 deletions.
27 changes: 14 additions & 13 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# Dependabot version updates, see:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "daily"

- package-ecosystem: "github-actions"
# Directory should be `/` instead of `/.github/workflows` according to the docs.
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "daily"
time: "06:00"
timezone: "Europe/Berlin"
- package-ecosystem: "github-actions"
# Directory should be `/` instead of `/.github/workflows` according to the docs.
directory: "/"
schedule:
interval: "daily"
time: "06:00"
timezone: "Europe/Berlin"
131 changes: 131 additions & 0 deletions .github/workflows/multi_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
name: Publish Multiple Releases
run-name: Publish v${{ github.event.inputs.mod_version }} build(s) from ${{ github.event.inputs.branches }}

on:
workflow_dispatch:
inputs:
mod_version:
description: "Mod version (without v or -MC)"
required: true
type: string
branches:
description: "Space-separated list of branches to publish from"
required: true
type: string
announce_ports:
description: "Announce as ports on WurstForum"
required: true
type: boolean
default: false
dry_run:
description: "Dry-run mode (don't actually publish anything)"
required: false
type: boolean
default: false

permissions:
# Needed to trigger the publish workflow.
actions: write

jobs:

prepare:
runs-on: ubuntu-latest
outputs:
branches: ${{ steps.set_branches.outputs.branches }}
steps:
- name: Convert branches input to JSON array
id: set_branches
run: |
JSON_ARRAY=$(echo "[\"$(echo ${{ inputs.branches }} | tr ' ' '\",\"')\"]")
echo "branches=$JSON_ARRAY" >> "$GITHUB_OUTPUT"
echo "Branches: $JSON_ARRAY" >> "$GITHUB_STEP_SUMMARY"
publish_each:
runs-on: ubuntu-latest
needs: prepare
if: ${{ !fromJson(inputs.dry_run) }}
strategy:
# Each job pushes an automated commit to wimods.net@master, so running them all in parallel
# would likely cause conflicts. Also, various servers might hit rate limits if we just upload
# all of the files at once.
max-parallel: 1
# If something goes wrong, all published files have to be manually deleted.
# Best to fail as early as possible.
fail-fast: true
matrix:
branch: ${{ fromJson(needs.prepare.outputs.branches) }}
# TODO: Maybe also verify that the mod_version in each branch is as expected before publishing?
steps:
- name: Build publish inputs
id: publish_inputs
run: |
JSON_STRING=$(cat << EOF
{
"close_milestone": "true",
"upload_backups": "true",
"publish_github": "true",
"publish_curseforge": "true",
"publish_modrinth": "true",
"update_website": "true"
}
EOF
)
# Convert to single line and escape quotes
echo "json=${JSON_STRING//$'\n'/}" >> "$GITHUB_OUTPUT"
- name: Trigger publish workflow
id: publish_dispatch
uses: codex-/return-dispatch@v2
with:
token: ${{ github.token }}
owner: Wurst-Imperium
repo: Mo-Glass
ref: ${{ matrix.branch }}
workflow: publish.yml
workflow_inputs: ${{ steps.publish_inputs.outputs.json }}
- name: Wait for publish workflow to finish (run ${{ steps.publish_dispatch.outputs.run_id }})
uses: codex-/await-remote-run@v1
with:
token: ${{ github.token }}
owner: Wurst-Imperium
repo: Mo-Glass
run_id: ${{ steps.publish_dispatch.outputs.run_id }}
run_timeout_seconds: 600 # 10 minutes

announce:
runs-on: ubuntu-latest
needs: [prepare, publish_each]
if: ${{ !failure() && !cancelled() && inputs.announce_ports }}
steps:
- name: Build announcement inputs
id: announce_inputs
run: |
JSON_STRING=$(cat << EOF
{
"mod": "mo-glass",
"mod_version": "${{ inputs.mod_version }}",
"branches": "${{ inputs.branches }}",
"dry_run": "${{ inputs.dry_run }}"
}
EOF
)
# Convert to single line and escape quotes
echo "json=${JSON_STRING//$'\n'/}" >> "$GITHUB_OUTPUT"
- name: Trigger announce workflow
id: announce_dispatch
uses: codex-/return-dispatch@v2
with:
token: ${{ secrets.WIMODS_NET_PUBLISH_TOKEN }}
owner: Wurst-Imperium
repo: wimods.net
ref: master
workflow: announce_mod_ports.yml
workflow_inputs: ${{ steps.announce_inputs.outputs.json }}
- name: Wait for announce workflow to finish (run ${{ steps.announce_dispatch.outputs.run_id }})
uses: codex-/await-remote-run@v1
with:
token: ${{ secrets.WIMODS_NET_PUBLISH_TOKEN }}
owner: Wurst-Imperium
repo: wimods.net
run_id: ${{ steps.announce_dispatch.outputs.run_id }}
run_timeout_seconds: 600 # 10 minutes
12 changes: 6 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
name: Publish Release
run-name: "Publish release from ${{ github.ref_name }} branch"

permissions:
# Needed to push the tag.
contents: write
# Needed to close the milestone.
issues: write

on:
workflow_dispatch:
inputs:
Expand Down Expand Up @@ -44,6 +38,12 @@ on:
description: "Automatically set by the return-dispatch action (leave blank if running manually)"
required: false

permissions:
# Needed to push the tag.
contents: write
# Needed to close the milestone.
issues: write

jobs:
publish:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
plugins {
id "fabric-loom" version "1.9-SNAPSHOT"
id "me.modmuss50.mod-publish-plugin" version "0.8.4"
id "com.diffplug.spotless" version "7.0.1"
id "com.diffplug.spotless" version "7.0.2"
}

def ENV = System.getenv()
Expand Down

0 comments on commit 68e057c

Please sign in to comment.