update: 更新beta14 #179
Workflow file for this run
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: Go Build and Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' # 触发条件:推送 tag | |
| workflow_dispatch: | |
| inputs: | |
| tag_name: | |
| description: 'Tag name for the release' | |
| required: true | |
| default: 'v2.5.9-Beta.14' | |
| permissions: | |
| contents: write | |
| # - [👏] | |
| # - [🔧] | |
| # - [☠️] | |
| env: | |
| PROJECT_NAME: ${{ github.event.repository.name }} | |
| BUILD_DATE: ${{ github.run_id }} | |
| VERSION: ${{ github.ref_name }} | |
| RELEASE_DIR: release | |
| RELEASE_NOTICES: | | |
| - [🔧] 修复学习通多任务点模式无法正常进行的BUG | |
| - [👏] 添加支持学习通自定义本地人脸(将人脸图片放在assets/faces/目录下,图片必须jpg后缀格式,并且图片名称以手机号命名) | |
| - [👏] 添加支持linux arm64打包(相当于你手机上安装termux linux就可以在手机里用了) | |
| 学习通用户注意: | |
| 如果学习通课程中有前置任务点完成才能解锁后续任务的不能使用多任务点模式!!!(多任务点模式会失效) | |
| 每天学习累计学时不要太久,超过1200分钟可能会打回学习进度(尤其是多课程或多任务点模式),请自行把控好。因为太离谱了。 | |
| 注:智慧职教刚上线,可能并不稳定,若有bug可发送issue或者加群反馈。(智慧职教仅支持Windows系统) | |
| jobs: | |
| build: | |
| name: Build (${{ matrix.os }}-${{ matrix.arch }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| arch: amd64 | |
| goos: linux | |
| - os: ubuntu-latest | |
| arch: arm64 | |
| goos: linux | |
| - os: windows-latest | |
| arch: amd64 | |
| goos: windows | |
| - os: macos-latest | |
| arch: amd64 | |
| goos: darwin | |
| - os: macos-latest | |
| arch: arm64 | |
| goos: darwin | |
| # 如果需要 armv7 (32位) 交叉编译,加下面一行 | |
| # - os: ubuntu-latest | |
| # arch: arm | |
| # goos: linux | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install dependencies (Linux) | |
| if: runner.os == 'Linux' && matrix.arch=='amd64' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libasound2-dev pkg-config gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf | |
| - name: Install dependencies (Linux) | |
| if: runner.os == 'Linux' && matrix.arch=='arm64' | |
| run: | | |
| sudo dpkg --add-architecture arm64 | |
| sudo apt-get update | |
| sudo apt-get install -y libc6:arm64 libc6-dev:arm64 | |
| sudo apt-get install -y libasound2-dev:arm64 pkg-config gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | |
| # Set up Go | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: 'go.mod' # Use Go version from go.mod | |
| cache: true # Enable dependency caching | |
| - name: Get dependencies(Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| export GOPROXY=direct | |
| export GONOSUMDB=* | |
| rm -rf go.sum | |
| go clean -modcache | |
| go env -w GOSUMDB=off | |
| go mod tidy | |
| - name: Get dependencies(MacOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| export GOPROXY=direct | |
| export GONOSUMDB=* | |
| rm -rf go.sum | |
| go clean -modcache | |
| go env -w GOSUMDB=off | |
| go mod tidy | |
| - name: Get dependencies(Windows) | |
| if: runner.os=='Windows' | |
| run: | | |
| set GOPROXY=direct | |
| set GONOSUMDB=* | |
| go clean -modcache | |
| del go.sum | |
| go get -u ./... | |
| go mod tidy | |
| - name: Prepare Release Directory #创建压缩目录 | |
| run: mkdir -p ${{ env.RELEASE_DIR }}/yatori-go-console.${{env.VERSION}}-linux-${{matrix.arch}}-release | |
| # Build Linux | |
| - name: Build Linux | |
| if: runner.os=='Linux' && matrix.arch=='amd64' | |
| run: | | |
| CGO_ENABLED=1 GOOS=linux GOARCH=${{matrix.arch}} go build \ | |
| -o ${{ env.RELEASE_DIR }}/yatori-go-console.${{env.VERSION}}-linux-${{matrix.arch}}-release/${{ env.PROJECT_NAME }} | |
| # Build Linux | |
| - name: Build Linux | |
| if: runner.os=='Linux' && matrix.arch=='arm64' | |
| run: | | |
| CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=${{matrix.arch}} go build \ | |
| -o ${{ env.RELEASE_DIR }}/yatori-go-console.${{env.VERSION}}-linux-${{matrix.arch}}-release/${{ env.PROJECT_NAME }} | |
| # Build Windows | |
| - name: Build Windows | |
| if: runner.os == 'Windows' | |
| run: | | |
| set CGO_ENABLED=1 | |
| set GOOS=windows | |
| set GOARCH=${{matrix.arch}} | |
| go build -o ${{ env.RELEASE_DIR }}\yatori-go-console.${{env.VERSION}}-windows-${{matrix.arch}}-release\${{ env.PROJECT_NAME }}.exe | |
| # 🧱 构建 Macos | |
| - name: Build macOS | |
| if: matrix.goos == 'darwin' | |
| run: | | |
| CGO_ENABLED=1 GOOS=darwin GOARCH=${{ matrix.arch }} go build \ | |
| -o ${{ env.RELEASE_DIR }}/yatori-go-console.${{env.VERSION}}-${{ matrix.goos }}-${{ matrix.arch }}-release/${{ env.PROJECT_NAME }} | |
| - name: Create release tar | |
| if: runner.os=='Linux' | |
| run: | # 打包发布版本压缩包 | |
| cp command/config.yaml ${{ env.RELEASE_DIR }}/yatori-go-console.${{env.VERSION}}-linux-${{matrix.arch}}-release | |
| cd ${{ env.RELEASE_DIR }} | |
| tar -czvf yatori-go-console.${{env.VERSION}}-linux-${{matrix.arch}}-release.tar.gz yatori-go-console.${{env.VERSION}}-linux-${{matrix.arch}}-release | |
| rm -rf yatori-go-console.${{env.VERSION}}-linux-${{matrix.arch}}-release | |
| cd .. | |
| - name: Create Release zip | |
| if: runner.os=='Windows' | |
| run: | | |
| copy command\config.yaml ${{ env.RELEASE_DIR }}\yatori-go-console.${{env.VERSION}}-windows-${{matrix.arch}}-release | |
| copy command\start.bat ${{ env.RELEASE_DIR }}\yatori-go-console.${{env.VERSION}}-windows-${{matrix.arch}}-release | |
| copy command\双击start.bat启动程序 ${{ env.RELEASE_DIR }}\yatori-go-console.${{env.VERSION}}-windows-${{matrix.arch}}-release | |
| cd ${{ env.RELEASE_DIR }} | |
| Compress-Archive -Path "yatori-go-console.${{env.VERSION}}-windows-${{matrix.arch}}-release" -DestinationPath "yatori-go-console.${{env.VERSION}}-windows-${{matrix.arch}}-release.zip" | |
| Remove-Item -Recurse -Force "yatori-go-console.${{env.VERSION}}-windows-${{matrix.arch}}-release" | |
| cd .. | |
| # 📦 打包 macOS (amd64+arm64) | |
| - name: Create macOS Release tar | |
| if: matrix.goos == 'darwin' | |
| run: | | |
| cp command/config.yaml ${{ env.RELEASE_DIR }}/yatori-go-console.${{env.VERSION}}-${{ matrix.goos }}-${{ matrix.arch }}-release | |
| cd ${{ env.RELEASE_DIR }} | |
| tar -czvf yatori-go-console.${{env.VERSION}}-${{ matrix.goos }}-${{ matrix.arch }}-release.tar.gz yatori-go-console.${{env.VERSION}}-${{ matrix.goos }}-${{ matrix.arch }}-release | |
| rm -rf yatori-go-console.${{env.VERSION}}-${{ matrix.goos }}-${{ matrix.arch }}-release | |
| cd .. | |
| - name: Upload Release | |
| uses: softprops/action-gh-release@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| files: ${{ env.RELEASE_DIR }}/* # 文件发布目录 | |
| tag_name: ${{ env.VERSION }} | |
| body: ${{ env.RELEASE_NOTICES }} | |
| draft: false | |
| prerelease: false |