mirror of
https://github.com/slhaf/Partner.git
synced 2026-05-12 08:43:02 +08:00
Compare commits
8 Commits
9acabca40e
...
release-ct
| Author | SHA1 | Date | |
|---|---|---|---|
| 68589a21fc | |||
| e8228d0cc1 | |||
| cc99e565f0 | |||
|
|
718271417d | ||
| 04ee38726b | |||
|
|
4a00e65868 | ||
| 6c3c08b5d5 | |||
| ef5a332f17 |
137
.github/workflows/release-core.yml
vendored
Normal file
137
.github/workflows/release-core.yml
vendored
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
name: Release Partner Core
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
tag:
|
||||||
|
description: "Core release tag, for example release-core/0.5.0"
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "release-core/*"
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release-core:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Resolve release metadata
|
||||||
|
id: release
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||||
|
TAG="${{ inputs.tag }}"
|
||||||
|
else
|
||||||
|
TAG="${GITHUB_REF_NAME}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
VERSION="${TAG#release-core/}"
|
||||||
|
VERSION="${VERSION#v}"
|
||||||
|
ENCODED_TAG="${TAG//\//%2F}"
|
||||||
|
ASSET_NAME="partner-core-${VERSION}.jar"
|
||||||
|
ASSET_URL="https://github.com/slhaf/Partner/releases/download/${ENCODED_TAG}/${ASSET_NAME}"
|
||||||
|
|
||||||
|
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "asset_name=${ASSET_NAME}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "asset_url=${ASSET_URL}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
echo "Core release tag: ${TAG}"
|
||||||
|
echo "Core release version: ${VERSION}"
|
||||||
|
echo "Core release asset: ${ASSET_NAME}"
|
||||||
|
|
||||||
|
- name: Checkout release source
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ steps.release.outputs.tag }}
|
||||||
|
|
||||||
|
- name: Set up Java 21
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: temurin
|
||||||
|
java-version: "21"
|
||||||
|
|
||||||
|
- name: Build Partner Core
|
||||||
|
run: |
|
||||||
|
mvn -B -DskipTests=true -pl Partner-Core -am package
|
||||||
|
|
||||||
|
- name: Prepare release artifact
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir -p dist
|
||||||
|
|
||||||
|
SOURCE_JAR="Partner-Core/target/partner-core-${{ steps.release.outputs.version }}.jar"
|
||||||
|
|
||||||
|
if [ ! -f "$SOURCE_JAR" ]; then
|
||||||
|
echo "Expected artifact not found: $SOURCE_JAR"
|
||||||
|
echo "Available Partner-Core target files:"
|
||||||
|
find Partner-Core/target -maxdepth 1 -type f -name "*.jar" -print
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cp "$SOURCE_JAR" "dist/${{ steps.release.outputs.asset_name }}"
|
||||||
|
ls -lh dist
|
||||||
|
|
||||||
|
- name: Create GitHub Release
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if gh release view "${{ steps.release.outputs.tag }}" >/dev/null 2>&1; then
|
||||||
|
echo "Release ${{ steps.release.outputs.tag }} already exists."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
gh release create "${{ steps.release.outputs.tag }}" \
|
||||||
|
"dist/${{ steps.release.outputs.asset_name }}" \
|
||||||
|
--title "Partner Core ${{ steps.release.outputs.version }}" \
|
||||||
|
--notes "Partner Core ${{ steps.release.outputs.version }}"
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
|
||||||
|
- name: Checkout master for registry update
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: master
|
||||||
|
path: registry-worktree
|
||||||
|
|
||||||
|
- name: Update latestRelease
|
||||||
|
working-directory: registry-worktree
|
||||||
|
run: |
|
||||||
|
python3 - <<'PY'
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
version = "${{ steps.release.outputs.version }}"
|
||||||
|
url = "${{ steps.release.outputs.asset_url }}"
|
||||||
|
|
||||||
|
index_path = Path("registry/index.json")
|
||||||
|
index = json.loads(index_path.read_text(encoding="utf-8"))
|
||||||
|
|
||||||
|
index["partner"]["latestRelease"] = {
|
||||||
|
"url": url,
|
||||||
|
"version": version
|
||||||
|
}
|
||||||
|
|
||||||
|
index_path.write_text(
|
||||||
|
json.dumps(index, ensure_ascii=False, indent=2) + "\n",
|
||||||
|
encoding="utf-8"
|
||||||
|
)
|
||||||
|
PY
|
||||||
|
|
||||||
|
- name: Commit registry update
|
||||||
|
working-directory: registry-worktree
|
||||||
|
run: |
|
||||||
|
if git diff --quiet registry/index.json; then
|
||||||
|
echo "No latestRelease changes."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
|
||||||
|
git add registry/index.json
|
||||||
|
git commit -m "chore(registry): update latest core release to ${{ steps.release.outputs.tag }}"
|
||||||
|
git push origin HEAD:master
|
||||||
156
.github/workflows/release-ctl.yml
vendored
Normal file
156
.github/workflows/release-ctl.yml
vendored
Normal file
@@ -0,0 +1,156 @@
|
|||||||
|
name: Release PartnerCtl
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
tag:
|
||||||
|
description: "Ctl release tag, for example release-ctl/0.5.0"
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "release-ctl/*"
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build ${{ matrix.platform }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- platform: linux-x64
|
||||||
|
runner: ubuntu-latest
|
||||||
|
binaryPath: PartnerCtl/target/partnerctl
|
||||||
|
assetSuffix: linux-x64
|
||||||
|
- platform: linux-arm64
|
||||||
|
runner: ubuntu-24.04-arm
|
||||||
|
binaryPath: PartnerCtl/target/partnerctl
|
||||||
|
assetSuffix: linux-arm64
|
||||||
|
- platform: windows-x64
|
||||||
|
runner: windows-latest
|
||||||
|
binaryPath: PartnerCtl/target/partnerctl.exe
|
||||||
|
assetSuffix: windows-x64.exe
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.runner }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Resolve release metadata
|
||||||
|
id: release
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||||
|
TAG="${{ inputs.tag }}"
|
||||||
|
else
|
||||||
|
TAG="${GITHUB_REF_NAME}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
VERSION="${TAG#release-ctl/}"
|
||||||
|
VERSION="${VERSION#v}"
|
||||||
|
ASSET_NAME="partnerctl-${VERSION}-${{ matrix.assetSuffix }}"
|
||||||
|
|
||||||
|
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "asset_name=${ASSET_NAME}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
echo "Ctl release tag: ${TAG}"
|
||||||
|
echo "Ctl release version: ${VERSION}"
|
||||||
|
echo "Ctl release asset: ${ASSET_NAME}"
|
||||||
|
|
||||||
|
- name: Checkout release source
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ steps.release.outputs.tag }}
|
||||||
|
|
||||||
|
- name: Set up GraalVM 21
|
||||||
|
uses: graalvm/setup-graalvm@v1
|
||||||
|
with:
|
||||||
|
distribution: graalvm-community
|
||||||
|
java-version: "21"
|
||||||
|
github-token: ${{ github.token }}
|
||||||
|
|
||||||
|
- name: Build partnerctl native image
|
||||||
|
run: mvn -B -DskipTests=true -pl PartnerCtl -am package native:compile
|
||||||
|
|
||||||
|
- name: Prepare release artifact
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir -p dist
|
||||||
|
|
||||||
|
BINARY_PATH="${{ matrix.binaryPath }}"
|
||||||
|
ASSET_PATH="dist/${{ steps.release.outputs.asset_name }}"
|
||||||
|
|
||||||
|
if [ ! -f "$BINARY_PATH" ]; then
|
||||||
|
echo "Expected native binary not found: $BINARY_PATH"
|
||||||
|
echo "Available PartnerCtl target files:"
|
||||||
|
find PartnerCtl/target -maxdepth 2 -type f -print
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cp "$BINARY_PATH" "$ASSET_PATH"
|
||||||
|
|
||||||
|
if [[ "${{ matrix.platform }}" == linux-* ]]; then
|
||||||
|
chmod +x "$ASSET_PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
ls -lh dist
|
||||||
|
|
||||||
|
- name: Upload release artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: ${{ steps.release.outputs.asset_name }}
|
||||||
|
path: dist/${{ steps.release.outputs.asset_name }}
|
||||||
|
if-no-files-found: error
|
||||||
|
retention-days: 1
|
||||||
|
|
||||||
|
release:
|
||||||
|
name: Create GitHub Release
|
||||||
|
needs: build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Resolve release metadata
|
||||||
|
id: release
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||||
|
TAG="${{ inputs.tag }}"
|
||||||
|
else
|
||||||
|
TAG="${GITHUB_REF_NAME}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
VERSION="${TAG#release-ctl/}"
|
||||||
|
VERSION="${VERSION#v}"
|
||||||
|
|
||||||
|
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
echo "Ctl release tag: ${TAG}"
|
||||||
|
echo "Ctl release version: ${VERSION}"
|
||||||
|
|
||||||
|
- name: Download release artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: dist
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
|
- name: Show release artifacts
|
||||||
|
run: |
|
||||||
|
ls -lh dist
|
||||||
|
|
||||||
|
- name: Create GitHub Release
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if gh release view "${{ steps.release.outputs.tag }}" >/dev/null 2>&1; then
|
||||||
|
echo "Release ${{ steps.release.outputs.tag }} already exists."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
gh release create "${{ steps.release.outputs.tag }}" \
|
||||||
|
dist/* \
|
||||||
|
--title "PartnerCtl ${{ steps.release.outputs.version }}" \
|
||||||
|
--notes "PartnerCtl ${{ steps.release.outputs.version }}"
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
137
.github/workflows/test-partnerctl-native.yml
vendored
Normal file
137
.github/workflows/test-partnerctl-native.yml
vendored
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
name: Test PartnerCtl Native Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
platform:
|
||||||
|
description: "Target platform to test"
|
||||||
|
required: true
|
||||||
|
default: "windows-x64"
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- windows-x64
|
||||||
|
- linux-x64
|
||||||
|
- linux-arm64
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test-linux-x64:
|
||||||
|
name: Test linux-x64
|
||||||
|
if: ${{ inputs.platform == 'linux-x64' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up GraalVM 21
|
||||||
|
uses: graalvm/setup-graalvm@v1
|
||||||
|
with:
|
||||||
|
distribution: graalvm-community
|
||||||
|
java-version: "21"
|
||||||
|
github-token: ${{ github.token }}
|
||||||
|
|
||||||
|
- name: Build partnerctl native image
|
||||||
|
run: mvn -B -DskipTests=true -pl PartnerCtl -am package native:compile
|
||||||
|
|
||||||
|
- name: Check Linux output
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [ ! -f "PartnerCtl/target/partnerctl" ]; then
|
||||||
|
echo "Expected native binary not found: PartnerCtl/target/partnerctl"
|
||||||
|
echo "Available PartnerCtl target files:"
|
||||||
|
find PartnerCtl/target -maxdepth 2 -type f -print
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
chmod +x PartnerCtl/target/partnerctl
|
||||||
|
./PartnerCtl/target/partnerctl --help
|
||||||
|
|
||||||
|
- name: Upload test artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: partnerctl-linux-x64-test
|
||||||
|
path: PartnerCtl/target/partnerctl
|
||||||
|
if-no-files-found: error
|
||||||
|
retention-days: 1
|
||||||
|
|
||||||
|
test-linux-arm64:
|
||||||
|
name: Test linux-arm64
|
||||||
|
if: ${{ inputs.platform == 'linux-arm64' }}
|
||||||
|
runs-on: ubuntu-24.04-arm
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up GraalVM 21
|
||||||
|
uses: graalvm/setup-graalvm@v1
|
||||||
|
with:
|
||||||
|
distribution: graalvm-community
|
||||||
|
java-version: "21"
|
||||||
|
github-token: ${{ github.token }}
|
||||||
|
|
||||||
|
- name: Build partnerctl native image
|
||||||
|
run: mvn -B -DskipTests=true -pl PartnerCtl -am package native:compile
|
||||||
|
|
||||||
|
- name: Check Linux output
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [ ! -f "PartnerCtl/target/partnerctl" ]; then
|
||||||
|
echo "Expected native binary not found: PartnerCtl/target/partnerctl"
|
||||||
|
echo "Available PartnerCtl target files:"
|
||||||
|
find PartnerCtl/target -maxdepth 2 -type f -print
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
chmod +x PartnerCtl/target/partnerctl
|
||||||
|
./PartnerCtl/target/partnerctl --help
|
||||||
|
|
||||||
|
- name: Upload test artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: partnerctl-linux-arm64-test
|
||||||
|
path: PartnerCtl/target/partnerctl
|
||||||
|
if-no-files-found: error
|
||||||
|
retention-days: 1
|
||||||
|
|
||||||
|
test-windows-x64:
|
||||||
|
name: Test windows-x64
|
||||||
|
if: ${{ inputs.platform == 'windows-x64' }}
|
||||||
|
runs-on: windows-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up GraalVM 21
|
||||||
|
uses: graalvm/setup-graalvm@v1
|
||||||
|
with:
|
||||||
|
distribution: graalvm-community
|
||||||
|
java-version: "21"
|
||||||
|
github-token: ${{ github.token }}
|
||||||
|
|
||||||
|
- name: Build partnerctl native image
|
||||||
|
run: mvn -B -DskipTests=true -pl PartnerCtl -am package native:compile
|
||||||
|
|
||||||
|
- name: Check Windows output
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
if (!(Test-Path "PartnerCtl/target/partnerctl.exe")) {
|
||||||
|
Write-Host "Expected native binary not found: PartnerCtl/target/partnerctl.exe"
|
||||||
|
Write-Host "Available PartnerCtl target files:"
|
||||||
|
Get-ChildItem -Recurse PartnerCtl/target | Select-Object FullName
|
||||||
|
throw "partnerctl.exe not found"
|
||||||
|
}
|
||||||
|
|
||||||
|
.\PartnerCtl\target\partnerctl.exe --help
|
||||||
|
|
||||||
|
- name: Upload test artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: partnerctl-windows-x64-test
|
||||||
|
path: PartnerCtl/target/partnerctl.exe
|
||||||
|
if-no-files-found: error
|
||||||
|
retention-days: 1
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
name: Update latest buildable
|
name: Update Latest Buildable
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|||||||
2
.github/workflows/update-module-index.yml
vendored
2
.github/workflows/update-module-index.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: update-module-index.yml
|
name: Update Module Index
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"ref": "buildable/0.5.0"
|
"ref": "buildable/0.5.0"
|
||||||
},
|
},
|
||||||
"latestRelease": {
|
"latestRelease": {
|
||||||
"url": "url",
|
"url": "https://github.com/slhaf/Partner/releases/download/release-core%2F0.5.0/partner-core-0.5.0.jar",
|
||||||
"version": "0.5.0"
|
"version": "0.5.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user