Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
release: | |
types: | |
- published | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: xmake-io/github-action-setup-xmake@v1 | |
# with: | |
# xmake-version: "2.9.3" | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/AppData/Local/.xmake | |
key: xmake-${{ hashFiles('xmake.lua') }} | |
restore-keys: | | |
xmake- | |
- uses: microsoft/setup-msbuild@v2 | |
- run: | | |
xmake repo -u | |
- run: | | |
xmake f -a x64 -m release -p windows -y | |
- run: | | |
xmake -w -y | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }} | |
path: | | |
bin/ | |
# SDK相关任务 | |
- name: Create SDK directories | |
run: | | |
mkdir SDK | |
mkdir SDK/lib | |
mkdir SDK/include | |
- name: Copy include files to SDK | |
run: | | |
Copy-Item -Path include/* -Destination SDK/include/ -Recurse -Force | |
shell: pwsh | |
- name: Copy .lib files to SDK/lib | |
run: | | |
New-Item -Path SDK/lib -ItemType Directory -Force | |
Copy-Item -Path build/windows/x64/release/*.lib -Destination SDK/lib/ -Force | |
shell: pwsh | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: SDK-${{ github.sha }} | |
path: SDK | |
update-release-notes: | |
outputs: | |
release_notes: ${{ steps.extract-release-notes.outputs.release_notes }} | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- id: extract-release-notes | |
uses: ffurrer2/extract-release-notes@v2 | |
- uses: softprops/action-gh-release@v1 | |
with: | |
body: |- | |
${{ steps.extract-release-notes.outputs.release_notes }} | |
| File | SHA256 | | |
| ---- | ------ | | |
upload-to-release: | |
needs: | |
- build | |
- update-release-notes | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }} | |
path: artifact | |
# Download SDK | |
- uses: actions/download-artifact@v4 | |
with: | |
name: SDK-${{ github.sha }} | |
path: sdk-artifact | |
- run: | | |
cp CHANGELOG.md README.md artifact/ | |
- run: | | |
zip -r ../${{ github.event.repository.name }}-windows-x64.zip * | |
working-directory: artifact | |
# Zip SDK | |
- run: | | |
zip -r ../SDK-PlotCraft.zip * | |
working-directory: sdk-artifact | |
- id: calculate-sha256-core | |
run: | | |
echo sha256=$(sha256sum ${{ github.event.repository.name }}-windows-x64.zip | awk '{print $1}') >> $GITHUB_OUTPUT | |
- id: calculate-sha256-sdk | |
run: | | |
echo sha256=$(sha256sum SDK-PlotCraft.zip | awk '{print $1}') >> $GITHUB_OUTPUT | |
- uses: softprops/action-gh-release@v1 | |
with: | |
append_body: true | |
body: |- | |
| ${{ github.event.repository.name }}-windows-x64.zip | ${{ steps.calculate-sha256-core.outputs.sha256 }} | | |
| SDK-PlotCraft.zip | ${{ steps.calculate-sha256-sdk.outputs.sha256 }} | | |
files: | | |
${{ github.event.repository.name }}-windows-x64.zip | |
SDK-PlotCraft.zip | |
upload-to-minebbs: | |
needs: | |
- build | |
- update-release-notes | |
runs-on: ubuntu-latest | |
steps: | |
# 检出代码 | |
- uses: actions/checkout@v4 | |
# 下载构建产物 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }} | |
path: artifact | |
# 复制文件 | |
- run: | | |
cp CHANGELOG.md README.md artifact/ | |
# 重新打包 | |
- run: | | |
zip -r ../${{ github.event.repository.name }}-windows-x64.zip * | |
working-directory: artifact | |
- name: Upload to MineBBS | |
uses: engsr6982/upload-minebbs@v2 | |
with: | |
minebbs_token: ${{ secrets.MINEBBS_TOKEN }} | |
resource_id: "8609" | |
upload_file: ${{ github.event.repository.name }}-windows-x64.zip | |
update_description: | | |
[MD] | |
> Tip: 此更新由 Github Actions 自动发布 | |
${{ needs.update-release-notes.outputs.release_notes }} | |
[/MD] |