2024-03-11 08:33:53 +00:00
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
types:
|
|
|
|
- opened
|
|
|
|
- synchronize
|
|
|
|
- labeled
|
|
|
|
workflow_dispatch:
|
2024-03-11 08:19:03 +00:00
|
|
|
|
2024-03-11 08:33:53 +00:00
|
|
|
permissions:
|
|
|
|
pull-requests: read
|
2024-03-11 08:30:19 +00:00
|
|
|
|
2024-03-11 08:33:53 +00:00
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- run: echo ${{github.event.action}}
|
2024-03-11 08:42:11 +00:00
|
|
|
- run: echo ${{ contains(github.event.pull_request.labels.*.name, 'watchdog-go') }}
|
2024-03-11 08:19:03 +00:00
|
|
|
|
2024-03-11 08:33:53 +00:00
|
|
|
build-docker-image:
|
|
|
|
runs-on: ubuntu-latest
|
2024-03-11 09:21:10 +00:00
|
|
|
container:
|
|
|
|
image: catthehacker/ubuntu:act-latest
|
2024-03-11 08:33:53 +00:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: ./watchdog-go
|
|
|
|
if: |
|
|
|
|
((github.event.action == 'labeled') &&
|
|
|
|
(github.event.label.name == 'watchdog-go')) ||
|
2024-03-11 08:44:39 +00:00
|
|
|
((github.event.action == 'synchronized') &&
|
2024-03-11 08:33:53 +00:00
|
|
|
contains(github.event.pull_request.labels.*.name, 'watchdog-go')) ||
|
|
|
|
(github.event.action == 'workflow_dispatch')
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
2024-03-11 09:02:51 +00:00
|
|
|
- uses: https://github.com/docker/setup-buildx-action@v3
|
2024-03-11 09:05:24 +00:00
|
|
|
- uses: https://github.com/docker/login-action@v3
|
2024-03-11 09:02:51 +00:00
|
|
|
with:
|
|
|
|
registry: git.usbharu.dev
|
|
|
|
username: usbharu
|
|
|
|
password: ${{ secrets.DEPLOY_TOKEN }}
|
2024-03-11 09:30:17 +00:00
|
|
|
- uses: https://github.com/docker/build-push-action@v5
|
2024-03-11 09:27:40 +00:00
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
file: ./Dockerfile
|
|
|
|
tags: git.usbharu.dev/usbharu/watchdog-go:latest,git.usbharu.dev/usbharu/watchdog-go:${{ github.sha }}
|
|
|
|
push: true
|