dyzur-bot/.forgejo/workflows/ci.yml

33 lines
920 B
YAML

name: Build and push Docker image
on:
push:
branches:
- main
jobs:
build:
runs-on: docker
container: golang:1.26-alpine
steps:
- name: Install tools
run: apk add --no-cache git docker-cli
- name: Checkout
run: git clone ${{ github.server_url }}/${{ github.repository }} . && git checkout ${{ github.sha }}
- name: Run tests
run: go test ./...
- 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 }}