feat(init): 项目初始化,支持GitLens Patch多版本处理 #10
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: CI/CD | |
| on: | |
| push: | |
| branches: [ main ] | |
| tags: [ 'v*' ] | |
| env: | |
| GO_VERSION: '1.24.3' | |
| GOLANGCI_LINT_VERSION: 'v2.2.2' | |
| jobs: | |
| build-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Install dependencies | |
| run: | | |
| go mod tidy | |
| go get github.com/stretchr/testify | |
| - name: Install golangci-lint | |
| run: | | |
| curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${{ env.GOLANGCI_LINT_VERSION }} | |
| - name: Lint | |
| run: make lint | |
| - name: Code format | |
| run: | | |
| if [ -f style.sh ]; then bash style.sh; fi | |
| - name: Build (local) | |
| run: make build-local | |
| - name: Test | |
| run: make test | |
| release: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: build-test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Install dependencies | |
| run: | | |
| go mod tidy | |
| go get github.com/stretchr/testify | |
| - name: Install golangci-lint | |
| run: | | |
| curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${{ env.GOLANGCI_LINT_VERSION }} | |
| - name: Lint | |
| run: make lint | |
| - name: Code format | |
| run: | | |
| if [ -f style.sh ]; then bash style.sh; fi | |
| - name: Build binaries (multi-platform) | |
| run: make build-binaries | |
| - name: Package binaries | |
| run: make package-binaries | |
| - name: Upload Release Assets | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: dist/* | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |