ci: add release workflow to publish binary on v* tags
This commit is contained in:
68
.gitea/workflows/release.yaml
Normal file
68
.gitea/workflows/release.yaml
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: scraper
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# ── lint & vet ───────────────────────────────────────────────────────────────
|
||||||
|
lint:
|
||||||
|
name: Lint
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version-file: scraper/go.mod
|
||||||
|
cache-dependency-path: scraper/go.sum
|
||||||
|
|
||||||
|
- name: go vet
|
||||||
|
run: go vet ./...
|
||||||
|
|
||||||
|
- name: staticcheck
|
||||||
|
run: go tool staticcheck ./...
|
||||||
|
|
||||||
|
# ── tests ────────────────────────────────────────────────────────────────────
|
||||||
|
test:
|
||||||
|
name: Test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version-file: scraper/go.mod
|
||||||
|
cache-dependency-path: scraper/go.sum
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: go test -race -count=1 -timeout=60s ./...
|
||||||
|
|
||||||
|
# ── build & release ──────────────────────────────────────────────────────────
|
||||||
|
release:
|
||||||
|
name: Release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [lint, test]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version-file: scraper/go.mod
|
||||||
|
cache-dependency-path: scraper/go.sum
|
||||||
|
|
||||||
|
- name: Build binary
|
||||||
|
run: |
|
||||||
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
|
||||||
|
go build -ldflags="-s -w" -o bin/scraper-linux-amd64 ./cmd/scraper
|
||||||
|
|
||||||
|
- name: Publish release
|
||||||
|
uses: actions/gitea-release@v1
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
files: scraper/bin/scraper-linux-amd64
|
||||||
Reference in New Issue
Block a user