setup workflow

This commit is contained in:
iceBear67
2026-08-08 13:13:27 +08:00
parent 2c69d10361
commit 644ec33b91
2 changed files with 94 additions and 9 deletions
+80
View File
@@ -0,0 +1,80 @@
name: Release
# Builds the nine platform jars and publishes them as a GitHub release.
#
# Two ways in:
# - push a tag matching v* (e.g. v1.0.0) -- the release is created at that
# tag, and the tag is checked against mod_version in gradle.properties so
# the jars and the release cannot disagree about what version they are;
# - run it by hand (workflow_dispatch) -- the release is created at the
# dispatched commit under the tag derived from mod_version, creating the
# tag if it does not exist yet.
on:
push:
tags: ['v*']
workflow_dispatch:
permissions:
contents: write
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Buckets 1-8 compile with a JDK 21 toolchain; 26.2 needs JDK 25, which
# Gradle provisions on its own through the foojay resolver in
# settings.gradle -- the same mechanism a local build uses.
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build all platforms
run: ./gradlew test buildAllPlatforms
- name: Resolve version
id: version
run: |
VERSION="$(sed -n 's/^mod_version=//p' gradle.properties)"
echo "mod_version=$VERSION" >> "$GITHUB_OUTPUT"
echo "tag=v$VERSION" >> "$GITHUB_OUTPUT"
if [[ "${{ github.event_name }}" == "push" && "v$VERSION" != "${{ github.ref_name }}" ]]; then
echo "::error::Tag ${{ github.ref_name }} does not match mod_version=$VERSION in gradle.properties (expected v$VERSION)"
exit 1
fi
- name: Collect jars
run: |
mkdir -p dist
for jar in platform/*/build/libs/*.jar; do
case "$jar" in
*-sources.jar) ;;
*) cp "$jar" dist/ ;;
esac
done
# platform/common is a source root, not a bucket -- count the real ones.
buckets="$(ls -d platform/*/ | grep -vc 'platform/common/')"
jars="$(ls dist | wc -l)"
test "$jars" -eq "$buckets"
ls -la dist
- name: Publish release
uses: softprops/action-gh-release@v2
with:
# On a tag push the pushed tag is used as-is; on a manual run the
# tag comes from mod_version and is created at the built commit.
tag_name: ${{ github.event_name == 'workflow_dispatch' && steps.version.outputs.tag || '' }}
target_commitish: ${{ github.event_name == 'workflow_dispatch' && github.sha || '' }}
files: dist/*
generate_release_notes: true
fail_on_unmatched_files: true
+14 -9
View File
@@ -29,15 +29,15 @@ Supports **Minecraft 1.20 through 26.2**, client side only. Requires
| Your Minecraft version | Jar |
| --- | --- |
| 1.20 1.20.1 | `photosync-1.20.1-1.0.0.jar` |
| 1.20.2 1.20.4 | `photosync-1.20.4-1.0.0.jar` |
| 1.20.5 1.20.6 | `photosync-1.20.6-1.0.0.jar` |
| 1.21 1.21.1 | `photosync-1.21.1-1.0.0.jar` |
| 1.21.2 1.21.4 | `photosync-1.21.4-1.0.0.jar` |
| 1.21.5 | `photosync-1.21.5-1.0.0.jar` |
| 1.21.6 1.21.10 | `photosync-1.21.8-1.0.0.jar` |
| 1.21.11 1.21.x | `photosync-1.21.11-1.0.0.jar` |
| 26.1 26.2 | `photosync-26.2-1.0.0.jar` |
| 1.20 1.20.1 | `photosync-1.20.1-x.y.z.jar` |
| 1.20.2 1.20.4 | `photosync-1.20.4-x.y.z.jar` |
| 1.20.5 1.20.6 | `photosync-1.20.6-x.y.z.jar` |
| 1.21 1.21.1 | `photosync-1.21.1-x.y.z.jar` |
| 1.21.2 1.21.4 | `photosync-1.21.4-x.y.z.jar` |
| 1.21.5 | `photosync-1.21.5-x.y.z.jar` |
| 1.21.6 1.21.10 | `photosync-1.21.8-x.y.z.jar` |
| 1.21.11 1.21.x | `photosync-1.21.11-x.y.z.jar` |
| 26.1 26.2 | `photosync-26.2-x.y.z.jar` |
Each jar declares its own supported range, so Fabric will refuse to load the
wrong one rather than crashing later.
@@ -215,6 +215,11 @@ version in a dev client:
./gradlew :platform:1.21.11:runClient
```
Releases are built and published by `.github/workflows/release.yml`: push a
`v<version>` tag (which must match `mod_version` in `gradle.properties`), or run
the workflow by hand and it builds the current commit and releases it under the
`mod_version` tag.
The source tree is one shared implementation plus nine thin per-version
adapters. If you are adding a Minecraft version or wondering why the layout is
the way it is, [`docs/PORTING.md`](docs/PORTING.md) is the document for that: it