fix: 修正GoReleaser hooks配置 #6
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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| goreleaser: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 检出代码 | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: 安装Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18' | |
| - name: 安装asar工具 | |
| run: npm install -g asar | |
| - name: 设置Go环境 | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.18' | |
| - name: 预处理数据文件 | |
| run: | | |
| # 确保任何.go文件都重命名为.go.txt | |
| find data -name "*.go" -type f -exec sh -c 'mv "$1" "${1%.go}.go.txt"' _ {} \; || true | |
| # 创建空的go.mod在数据目录中避免递归查找模块 | |
| touch data/go.mod | |
| - name: 运行测试 | |
| run: go test -v ./pkg/cracker/... | |
| - name: 使用GoReleaser发布 | |
| uses: goreleaser/goreleaser-action@v5 | |
| with: | |
| distribution: goreleaser | |
| version: latest | |
| args: release --clean --skip-validate | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |