修复坠星天矛&禁止雷劈产生闪电熔岩 #39
This file contains hidden or 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
| name: build (Curseforge) | |
| on: | |
| push: | |
| paths: | |
| - "minecraft/**" | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| actions: write | |
| contents: read | |
| defaults: | |
| run: | |
| working-directory: ./minecraft | |
| steps: | |
| - name: 1. 检出仓库 | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: 2. 设置 Go 语言环境 | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.23.3" | |
| cache: false | |
| - name: 3. 安装 packwiz | |
| run: go install github.com/packwiz/packwiz@latest | |
| - name: 4. 导出 Curseforge 整合包 | |
| id: export | |
| run: | | |
| packwiz curseforge export | |
| - name: 5. 重命名整合包文件 | |
| run: | | |
| original_name=$(ls *.zip | head -n 1 | sed 's/.zip$//') | |
| short_sha=$(git log -1 --format="%h" -- .) | |
| new_name="${original_name}-build-${short_sha}" | |
| mv "${original_name}.zip" "${new_name}.zip" | |
| echo "FILE_PATH=${new_name}.zip" >> $GITHUB_ENV | |
| echo "FILE_NAME=${new_name}" >> $GITHUB_ENV | |
| - name: 6. 创建空目录并解压 | |
| run: | | |
| mkdir -p unzipped | |
| unzip -O UTF-8 "$FILE_PATH" -d unzipped/ | |
| - name: 7. 上传至 Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.FILE_NAME }} | |
| path: minecraft/unzipped/ | |
| retention-days: 4 |