Skip to content

update: 更新2.5.9-beta.9 #175

update: 更新2.5.9-beta.9

update: 更新2.5.9-beta.9 #175

Workflow file for this run

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.9'
permissions:
contents: write
# - [👏]
# - [‍🔧]
# - [☠️]
env:
PROJECT_NAME: ${{ github.event.repository.name }}
BUILD_DATE: ${{ github.run_id }}
VERSION: ${{ github.ref_name }}
RELEASE_DIR: release
RELEASE_NOTICES: |
- [👏] 支持学习通IP代理功能(在exe同级目录下创建ip.txt文件并将ip:port写入文件即可,每行一条,并且要求代理必须支持https代理)
- [‍🔧] 修复学习通视屏模式错误问题
- [‍🔧] 修复英华学堂AI自动答题BUG
注意如果学习通课程中有前置任务点完成才能解锁后续任务的不能使用多任务点模式!!!(多任务点模式会失效)
注意!!!!!学习通多任务点模式下不要同时有超过2个学习通账号,容易触发学习通风控导致封IP(一般封十几分钟),怕出问题的就不要用多任务点模式(videoModel 3)
注:智慧职教刚上线,可能并不稳定,若有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