ci: add CI workflow (tests, goimports, staticcheck, build) and fix release auth

This commit is contained in:
2026-03-11 21:53:35 +00:00
parent 7779280840
commit e64fff9e99
2 changed files with 16 additions and 2 deletions

View File

@@ -9,6 +9,9 @@ on:
permissions: permissions:
contents: read contents: read
env:
GOPRIVATE: github.com/taigrr/*
jobs: jobs:
lint: lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -19,6 +22,9 @@ jobs:
with: with:
go-version-file: go.mod go-version-file: go.mod
- name: Configure private modules
run: git config --global url."https://${{ secrets.GH_PAT }}@github.com/".insteadOf "https://github.com/"
- name: Check goimports - name: Check goimports
run: | run: |
go install golang.org/x/tools/cmd/goimports@latest go install golang.org/x/tools/cmd/goimports@latest
@@ -38,6 +44,9 @@ jobs:
with: with:
go-version-file: go.mod go-version-file: go.mod
- name: Configure private modules
run: git config --global url."https://${{ secrets.GH_PAT }}@github.com/".insteadOf "https://github.com/"
- name: Run tests - name: Run tests
run: go test -race -v ./... run: go test -race -v ./...
@@ -50,5 +59,8 @@ jobs:
with: with:
go-version-file: go.mod go-version-file: go.mod
- name: Configure private modules
run: git config --global url."https://${{ secrets.GH_PAT }}@github.com/".insteadOf "https://github.com/"
- name: Build - name: Build
run: go build -v ./... run: go build -v ./...

View File

@@ -8,6 +8,9 @@ on:
permissions: permissions:
contents: write contents: write
env:
GOPRIVATE: github.com/taigrr/*
jobs: jobs:
release: release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -21,8 +24,7 @@ jobs:
go-version-file: go.mod go-version-file: go.mod
- name: Configure private modules - name: Configure private modules
run: git config --global url."https://${{ secrets.GO_MODULE_PAT }}@github.com/".insteadOf "https://github.com/" run: git config --global url."https://${{ secrets.GH_PAT }}@github.com/".insteadOf "https://github.com/"
if: ${{ secrets.GO_MODULE_PAT != '' }}
- uses: goreleaser/goreleaser-action@v6 - uses: goreleaser/goreleaser-action@v6
with: with: