name: build and push binary to release on: release: types: [created,published] # 表示在创建新的 Release 时触发 jobs: build-go-binary: runs-on: ubuntu-latest strategy: matrix: goos: [linux, windows, darwin] # 需要打包的系统 goarch: [amd64, arm64] # 需要打包的架构 exclude: # 排除某些平台和架构 - goarch: arm64 goos: windows steps: - uses: actions/checkout@v3 - run: | release_url=$(curl -s https://api.github.com/repos/opsre/go-ldap-admin-ui/releases/latest | grep "browser_download_url" | grep -v 'dist.zip.md5' | cut -d '"' -f 4); wget $release_url && unzip dist.zip && rm dist.zip && mv dist public/static - uses: wangyoucao577/go-release-action@v1 with: github_token: ${{ secrets.GITHUB_TOKEN }} # 一个默认的变量,用来实现往 Release 中添加文件 goos: ${{ matrix.goos }} goarch: ${{ matrix.goarch }} goversion: 1.18 # 可以指定编译使用的 Golang 版本 binary_name: "go-ldap-admin" # 可以指定二进制文件的名称 extra_files: LICENSE config.yml README.md # 需要包含的额外文件