40 lines
1.2 KiB
YAML
40 lines
1.2 KiB
YAML
name: Build, push image, and notify Watchtower
|
|
on:
|
|
push:
|
|
branches:
|
|
- main # Only triggers the build on the main branch
|
|
|
|
jobs:
|
|
build-image:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Login to Gitea Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: git.matthiasg.dev
|
|
username: ninluc
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
- name: Cache Docker layers
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: /tmp/.buildx-cache
|
|
key: buildx-cache-${{ github.sha }}
|
|
restore-keys: |
|
|
buildx-cache-
|
|
|
|
- name: Build and push Docker image
|
|
run: |
|
|
docker build --file cloud/Dockerfile -t git.matthiasg.dev/ninluc/smartwave-api:latest .
|
|
docker push git.matthiasg.dev/ninluc/smartwave-api:latest
|
|
|
|
notify:
|
|
needs: build-image
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
|
|
- name: Notify Watchtower
|
|
run: "echo \"${{ secrets.WATCHTOWER_TOKEN }}\" && curl -i -X POST -H \"Authorization: Bearer ${{ secrets.WATCHTOWER_TOKEN }}\" https://watchtower.smartwave.matthiasg.dev/v1/update" |