unos/.gitea/workflows/watchdog-build.yaml

40 lines
1.1 KiB
YAML

on:
pull_request:
types:
- opened
- synchronize
- labeled
workflow_dispatch:
permissions:
pull-requests: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- run: echo ${{github.event.action}}
- run: echo ${{ contains(github.event.pull_request.labels.*.name, 'watchdog-go') }}
build-docker-image:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./watchdog-go
if: |
((github.event.action == 'labeled') &&
(github.event.label.name == 'watchdog-go')) ||
((github.event.action == 'synchronized') &&
contains(github.event.pull_request.labels.*.name, 'watchdog-go')) ||
(github.event.action == 'workflow_dispatch')
steps:
- uses: actions/checkout@v3
- uses: https://github.com/docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: git.usbharu.dev
username: usbharu
password: ${{ secrets.DEPLOY_TOKEN }}
- run: docker build ./ watchdog-go -t latest -t ${{ github.sha }}
- run: docker push git.usbharu.dev/usbharu/watchdog-go:${{ github.sha }}