mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-07 22:06:38 +08:00
2
This commit is contained in:
@@ -177,9 +177,32 @@ jobs:
|
|||||||
path: web/dist
|
path: web/dist
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
|
|
||||||
build-binaries:
|
# 先创建(幂等)空的 GitHub Release,供后续 build-binaries 并行上传附件,
|
||||||
needs: [version-and-publish, build-frontend]
|
# 也避免矩阵各 job 并发 upload 时 release 尚不存在而互相竞争。
|
||||||
|
publish-create-release:
|
||||||
|
needs: [version-and-publish]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Create release
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
RELEASE_TAG: ${{ needs.version-and-publish.outputs.tag }}
|
||||||
|
run: |
|
||||||
|
set -eux
|
||||||
|
# tag 已由 version-and-publish 推送;若 release 已存在则忽略(--verify-tag 幂等)
|
||||||
|
gh release create "$RELEASE_TAG" \
|
||||||
|
--title "MMTL ${{ needs.version-and-publish.outputs.new_version }}" \
|
||||||
|
--notes "自动化发布 ${{ needs.version-and-publish.outputs.new_version }}" \
|
||||||
|
--verify-tag --latest || true
|
||||||
|
|
||||||
|
build-binaries:
|
||||||
|
needs: [version-and-publish, build-frontend, publish-create-release]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@@ -228,41 +251,18 @@ jobs:
|
|||||||
else
|
else
|
||||||
tar -czf "mmtl_${{ matrix.goos }}_${{ matrix.goarch }}.tar.gz" -C package mmtl
|
tar -czf "mmtl_${{ matrix.goos }}_${{ matrix.goarch }}.tar.gz" -C package mmtl
|
||||||
fi
|
fi
|
||||||
- name: Upload package
|
- name: Upload to GitHub Release
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: mmtl-package-${{ matrix.goos }}-${{ matrix.goarch }}
|
|
||||||
path: |
|
|
||||||
mmtl_${{ matrix.goos }}_${{ matrix.goarch }}.zip
|
|
||||||
mmtl_${{ matrix.goos }}_${{ matrix.goarch }}.tar.gz
|
|
||||||
if-no-files-found: ignore
|
|
||||||
retention-days: 1
|
|
||||||
|
|
||||||
publish-release:
|
|
||||||
needs: [version-and-publish, build-binaries]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Download all artifacts
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
path: release-assets
|
|
||||||
merge-multiple: true
|
|
||||||
- name: Create / update GitHub Release
|
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
RELEASE_TAG: ${{ needs.version-and-publish.outputs.tag }}
|
RELEASE_TAG: ${{ needs.version-and-publish.outputs.tag }}
|
||||||
run: |
|
run: |
|
||||||
set -eux
|
set -eux
|
||||||
echo "tag=$RELEASE_TAG"
|
PKG="mmtl_${{ matrix.goos }}_${{ matrix.goarch }}.zip"
|
||||||
# 若 release 不存在则创建(tag 已由 version-and-publish 推送)
|
TAR="mmtl_${{ matrix.goos }}_${{ matrix.goarch }}.tar.gz"
|
||||||
gh release create "$RELEASE_TAG" \
|
# 并发上传到同一 release 各自文件,--clobber 幂等覆盖
|
||||||
--title "MMTL ${{ needs.version-and-publish.outputs.new_version }}" \
|
if [ -f "$PKG" ]; then
|
||||||
--notes "自动化发布 ${{ needs.version-and-publish.outputs.new_version }}" \
|
for i in 1 2 3; do gh release upload "$RELEASE_TAG" "$PKG" --clobber && break || sleep 5; done
|
||||||
--verify-tag --latest || true
|
fi
|
||||||
# 上传所有平台产物(已存在的同名 asset 会直接覆盖)
|
if [ -f "$TAR" ]; then
|
||||||
for f in release-assets/mmtl_*.zip release-assets/mmtl_*.tar.gz; do
|
for i in 1 2 3; do gh release upload "$RELEASE_TAG" "$TAR" --clobber && break || sleep 5; done
|
||||||
[ -e "$f" ] && gh release upload "$RELEASE_TAG" "$f" --clobber || true
|
fi
|
||||||
done
|
|
||||||
|
|||||||
Reference in New Issue
Block a user