update: 更新更新beta8 #174
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.8' | |
| permissions: | |
| contents: write | |
| # - [👏] | |
| # - [🔧] | |
| # - [☠️] | |
| env: | |
| PROJECT_NAME: ${{ github.event.repository.name }} | |
| BUILD_DATE: ${{ github.run_id }} | |
| VERSION: ${{ github.ref_name }} | |
| RELEASE_DIR: release | |
| RELEASE_NOTICES: | | |
| - [👏] 因智慧职教验证码变动,现添加Cookie登录(请使用智慧职教时自行先在网页端登录并复制登录后的Cookie填入password字段,程序会自动识别) | |
| - [👏] WeLearn添加刷取学时可自定义调节 | |
| - [👏] 首创学习通多任务点模式学习(学习速度翻3倍!!不过建议一般情况下少用或许有小概率封号风险,一般封禁十几分钟左右) | |
| - [👏] 使用学习通的同学注意!!!!!该版本将会有模式视屏模式选择上的改动(videModel为0为关闭,1为普通模式,2为多课程模式,3多任务点模式(3倍效率完成任务点)) | |
| - [👏] 智慧职教支持Cookie登录使用(将web页面登录好的Cookie复制好后在config内password字段将原本的密码替换为复制的cookie就好,软件会自动识别) | |
| 注意!!!!!学习通多任务点模式一般情况下不要使用!!!!!!!有小概率封号风险(一般封禁十几分钟),这个是给那些时间快到的课程刷的紧急需求。 | |
| 注:智慧职教刚上线,可能并不稳定,若有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: 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 | |
| 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 |