mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-06-25 03:04:26 +08:00
- Upgrade actions/checkout from v4 to v7 - Upgrade actions/setup-dotnet from v4 to v5 - Upgrade actions/upload-artifact from v4 to v7 - Upgrade actions/download-artifact from v4 to v4 (already compatible) - Upgrade ncipollo/release-action from v1 to v1.21.0 This addresses GitHub's deprecation of Node.js 20 and the upcoming forced migration to Node.js 24 (effective June 2, 2026).
139 lines
5.1 KiB
YAML
139 lines
5.1 KiB
YAML
name: PLONDS Publisher
|
|
|
|
concurrency:
|
|
group: plonds-publish-${{ github.event_name }}-${{ github.event.workflow_run.id || github.event.inputs.tag || github.run_id }}
|
|
cancel-in-progress: false
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows:
|
|
- PLONDS Comparator
|
|
types:
|
|
- completed
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: 'Release tag'
|
|
required: true
|
|
type: string
|
|
|
|
env:
|
|
DOTNET_VERSION: '10.0.x'
|
|
PLONDS_S3_PREFIX: lanmountain/update/plonds
|
|
PLONDS_S3_PUBLIC_BASE_KEY_PREFIX: lanmountain/update
|
|
PLONDS_S3_DIRECTORY_UPLOAD_CONCURRENCY: '4'
|
|
PLONDS_S3_MULTIPART_THRESHOLD_MB: '10'
|
|
PLONDS_S3_MULTIPART_PART_SIZE_MB: '10'
|
|
PLONDS_S3_MULTIPART_CONCURRENCY: '4'
|
|
|
|
jobs:
|
|
publish:
|
|
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 360
|
|
permissions:
|
|
contents: write
|
|
actions: read
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 0
|
|
submodules: recursive
|
|
|
|
- name: Resolve release tag
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
|
RAW_TAG="${{ github.event.inputs.tag }}"
|
|
if [[ "$RAW_TAG" == v* ]]; then
|
|
TAG="$RAW_TAG"
|
|
else
|
|
TAG="v$RAW_TAG"
|
|
fi
|
|
else
|
|
gh run download "${{ github.event.workflow_run.id }}" -n plonds-run-metadata -D plonds-run-metadata
|
|
TAG="$(tr -d '\r\n' < plonds-run-metadata/tag.txt)"
|
|
fi
|
|
|
|
gh release view "$TAG" --repo "${{ github.repository }}" --json tagName >/dev/null
|
|
echo "RELEASE_TAG=${TAG}" >> "$GITHUB_ENV"
|
|
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v5
|
|
with:
|
|
dotnet-version: ${{ env.DOTNET_VERSION }}
|
|
dotnet-quality: preview
|
|
|
|
- name: Build PLONDS tool
|
|
run: dotnet build PenguinLogisticsOnlineNetworkDistributionSystem/src/Plonds.Tool/Plonds.Tool.csproj -c Release
|
|
|
|
- name: Download PLONDS release assets
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
rm -rf plonds-assets
|
|
mkdir -p plonds-assets
|
|
gh release download "$RELEASE_TAG" -p changed.zip -p PLONDS.json -p files-windows-x64.zip -D plonds-assets --clobber
|
|
test -f plonds-assets/changed.zip
|
|
test -f plonds-assets/PLONDS.json
|
|
test -f plonds-assets/files-windows-x64.zip
|
|
jq -e . plonds-assets/PLONDS.json >/dev/null
|
|
|
|
- name: Publish PLONDS assets to Rainyun S3
|
|
env:
|
|
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
|
|
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }}
|
|
S3_ENDPOINT: ${{ vars.S3_ENDPOINT }}
|
|
S3_REGION: ${{ vars.S3_REGION }}
|
|
S3_BUCKET: ${{ vars.S3_BUCKET }}
|
|
S3_PUBLIC_BASE_URL: ${{ vars.S3_PUBLIC_BASE_URL }}
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
if [[ -z "${S3_ACCESS_KEY:-}" || -z "${S3_SECRET_KEY:-}" || -z "${S3_ENDPOINT:-}" || -z "${S3_BUCKET:-}" ]]; then
|
|
echo "S3_ACCESS_KEY, S3_SECRET_KEY, S3_ENDPOINT, and S3_BUCKET must be configured."
|
|
exit 1
|
|
fi
|
|
|
|
REGION="${S3_REGION:-us-east-1}"
|
|
PUBLIC_BASE="${S3_PUBLIC_BASE_URL:-https://cn-nb1.rains3.com/lmdesktop}"
|
|
PUBLIC_BASE="${PUBLIC_BASE%/}"
|
|
|
|
dotnet run --project PenguinLogisticsOnlineNetworkDistributionSystem/src/Plonds.Tool/Plonds.Tool.csproj --configuration Release -- \
|
|
publish-s3 \
|
|
--release-tag "$RELEASE_TAG" \
|
|
--repository "${{ github.repository }}" \
|
|
--manifest "$PWD/plonds-assets/PLONDS.json" \
|
|
--changed-zip "$PWD/plonds-assets/changed.zip" \
|
|
--files-zip "$PWD/plonds-assets/files-windows-x64.zip" \
|
|
--work-dir "$PWD/plonds-publish-work" \
|
|
--s3-prefix "$PLONDS_S3_PREFIX" \
|
|
--s3-endpoint "$S3_ENDPOINT" \
|
|
--s3-region "$REGION" \
|
|
--s3-bucket "$S3_BUCKET" \
|
|
--s3-access-key "$S3_ACCESS_KEY" \
|
|
--s3-secret-key "$S3_SECRET_KEY" \
|
|
--s3-public-base-url "$PUBLIC_BASE" \
|
|
--s3-public-base-key-prefix "$PLONDS_S3_PUBLIC_BASE_KEY_PREFIX" \
|
|
--directory-upload-concurrency "$PLONDS_S3_DIRECTORY_UPLOAD_CONCURRENCY" \
|
|
--multipart-threshold-mb "$PLONDS_S3_MULTIPART_THRESHOLD_MB" \
|
|
--multipart-part-size-mb "$PLONDS_S3_MULTIPART_PART_SIZE_MB" \
|
|
--multipart-concurrency "$PLONDS_S3_MULTIPART_CONCURRENCY"
|
|
|
|
jq -e '.downloads.github.changedZipUrl and .downloads.github.filesZipUrl and .downloads.s3.changedFolderUrl and .downloads.s3.filesFolderUrl' plonds-assets/PLONDS.json >/dev/null
|
|
|
|
- name: Upload enriched PLONDS manifest to GitHub Release
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
gh release upload "$RELEASE_TAG" plonds-assets/PLONDS.json --clobber
|