From 6314bb6d990d5b142b73d42b731aeb89ee5c4bd4 Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Mon, 11 Mar 2024 10:09:22 +0000 Subject: [PATCH] watchdog-go: ci Reviewed-on: https://git.usbharu.dev/usbharu/unos/pulls/1 Co-authored-by: usbharu <64310155+usbharu@users.noreply.github.com> Co-committed-by: usbharu <64310155+usbharu@users.noreply.github.com> --- .gitea/workflows/watchdog-build.yaml | 68 ++++++++++++++++++---------- ignore | 0 2 files changed, 44 insertions(+), 24 deletions(-) create mode 100644 ignore diff --git a/.gitea/workflows/watchdog-build.yaml b/.gitea/workflows/watchdog-build.yaml index 446ca08..5aad66b 100644 --- a/.gitea/workflows/watchdog-build.yaml +++ b/.gitea/workflows/watchdog-build.yaml @@ -1,26 +1,46 @@ - on: - pull_request: - types: - - opened - - synchronize - - labeled - workflow_dispatch: +on: + pull_request: + types: + - opened + - synchronize + - labeled + workflow_dispatch: - jobs: - 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 == 'synchronize') && - contains(github.event.pull_request.labels.*.name, 'watchdog-go') || - (github.event.action == 'workflow_dispatch') +permissions: + pull-requests: read - steps: - - uses: actions/checkout@v3 - - run: docker login -u usbharu -p ${{ secrets.DEPLOY_TOKEN }} git.usbharu.dev - - run: docker build ./ watchdog-go -t latest -t ${{ github.sha }} - - run: docker push git.usbharu.dev/usbharu/watchdog-go:${{ github.sha }} \ No newline at end of file +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 + container: + image: catthehacker/ubuntu:act-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: https://github.com/docker/login-action@v3 + with: + registry: git.usbharu.dev + username: usbharu + password: ${{ secrets.DEPLOY_TOKEN }} + - uses: https://github.com/docker/build-push-action@v5 + with: + context: ./watchdog-go + + tags: git.usbharu.dev/usbharu/watchdog-go:latest,git.usbharu.dev/usbharu/watchdog-go:${{ github.sha }} + push: true \ No newline at end of file diff --git a/ignore b/ignore new file mode 100644 index 0000000..e69de29