41 lines
1.2 KiB
YAML
41 lines
1.2 KiB
YAML
name: Build and push Docker image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: docker
|
|
container: golang:1.26.4-alpine
|
|
steps:
|
|
- name: Install tools
|
|
# build-base provides the C toolchain the race detector needs (-race
|
|
# implies CGO).
|
|
run: apk add --no-cache git docker-cli build-base
|
|
|
|
- name: Checkout
|
|
run: git clone ${{ github.server_url }}/${{ github.repository }} . && git checkout ${{ github.sha }}
|
|
|
|
- name: Run tests
|
|
run: go test -race ./...
|
|
|
|
- name: Run linter
|
|
run: go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest run
|
|
|
|
- name: Check for known vulnerabilities
|
|
run: go run golang.org/x/vuln/cmd/govulncheck@latest ./...
|
|
|
|
- name: Log in to container registry
|
|
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login git.kambr.pl -u "${{ secrets.REGISTRY_USER }}" --password-stdin
|
|
|
|
- name: Build and push
|
|
run: |
|
|
docker build \
|
|
-t git.kambr.pl/kamash/dyzur-bot:latest \
|
|
-t git.kambr.pl/kamash/dyzur-bot:${{ github.sha }} \
|
|
.
|
|
docker push git.kambr.pl/kamash/dyzur-bot:latest
|
|
docker push git.kambr.pl/kamash/dyzur-bot:${{ github.sha }}
|