name: CI on: push: branches: - "**" pull_request: branches: - "**" jobs: lint: runs-on: ubuntu-latest permissions: contents: read steps: - uses: actions/checkout@v6 - uses: actions/setup-go@v6 with: go-version-file: "go.mod" - name: golangci-lint uses: golangci/golangci-lint-action@v9 with: version: v2.10.1 test: runs-on: ubuntu-latest permissions: contents: read steps: - uses: actions/checkout@v6 - uses: actions/setup-go@v6 with: go-version-file: "go.mod" - name: Install gotestfmt run: go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest - name: Run tests run: | set -euo pipefail go test -json -race -covermode=atomic -coverprofile=coverage.out ./pkg/... 2>&1 | tee /tmp/gotest.log | gotestfmt build: runs-on: ubuntu-latest permissions: contents: read needs: - lint - test steps: - uses: actions/checkout@v6 - uses: actions/setup-go@v6 with: go-version-file: "go.mod" - name: Build run: make build release: runs-on: ubuntu-latest permissions: contents: write needs: build if: github.event_name != 'pull_request' steps: - uses: actions/checkout@v6 with: fetch-depth: 0 - uses: actions/setup-go@v6 with: go-version-file: "go.mod" - name: Build and install provider-zexlab plugin run: | go build -o provider-zexlab ./cmd/provider-zexlab/ PLUGIN_DIR=".semrel/$(go env GOOS)_$(go env GOARCH)/provider-zexlab/0.0.0-dev" mkdir -p "$PLUGIN_DIR" mv provider-zexlab "$PLUGIN_DIR/provider-zexlab" chmod +x "$PLUGIN_DIR/provider-zexlab" - uses: go-semantic-release/action@v1 id: semrel with: github-token: ${{ secrets.ZX_TOKEN }} allow-initial-development-versions: true custom-arguments: "--provider zexlab" env: GITEA_TOKEN: ${{ secrets.ZX_TOKEN }} - name: Fetch new tag if: steps.semrel.outputs.version != '' run: git fetch --tags origin - name: Run GoReleaser if: steps.semrel.outputs.version != '' uses: goreleaser/goreleaser-action@v6 with: version: "~> v2" args: release --clean --skip=validate env: GITEA_TOKEN: ${{ secrets.ZX_TOKEN }}