Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b562e84b88 | |||
| 476945722b | |||
| 2494e71969 | |||
| 46ef00c742 |
@@ -0,0 +1,37 @@
|
|||||||
|
name: Docker Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: gitea.shcizo.se
|
||||||
|
username: ${{ gitea.actor }}
|
||||||
|
password: ${{ secrets.PACKAGES_TOKEN }}
|
||||||
|
|
||||||
|
- uses: docker/metadata-action@v5
|
||||||
|
id: meta
|
||||||
|
with:
|
||||||
|
images: gitea.shcizo.se/shcizo/package-updater
|
||||||
|
tags: |
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=raw,value=latest
|
||||||
|
|
||||||
|
- uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
@@ -35,7 +35,7 @@ Defense in depth: a valid bearer token AND the opt-in label must both be present
|
|||||||
4. Point your reverse proxy (NPM/Traefik/Caddy) at `package-updater:8080`. NPM should handle TLS.
|
4. Point your reverse proxy (NPM/Traefik/Caddy) at `package-updater:8080`. NPM should handle TLS.
|
||||||
5. `docker compose up -d`.
|
5. `docker compose up -d`.
|
||||||
6. Add the opt-in label `se.shcizo.auto-update: "true"` to each service you want auto-updated.
|
6. Add the opt-in label `se.shcizo.auto-update: "true"` to each service you want auto-updated.
|
||||||
7. Use the [Gitea composite action](gitea-action/README.md) in your repos to call `/update` after a build.
|
7. Use the [Gitea composite action](https://gitea.shcizo.se/shcizo/package-updater-action) in your repos to call `/update` after a build.
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
# Deploy via package-updater (composite action)
|
|
||||||
|
|
||||||
Notifies `package-updater` to `docker compose pull` + `up -d` for the matching service(s) after a CI build.
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
In a consumer repo's `.gitea/workflows/deploy.yml`:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
jobs:
|
|
||||||
deploy:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [build-and-push]
|
|
||||||
steps:
|
|
||||||
- uses: gitea.example.com/shcizo/package-updater/gitea-action@v1
|
|
||||||
with:
|
|
||||||
endpoint: https://updater.example.com/update
|
|
||||||
image: registry.example.com/${{ gitea.repository }}
|
|
||||||
tag: ${{ gitea.sha }}
|
|
||||||
token: ${{ secrets.UPDATER_TOKEN }}
|
|
||||||
```
|
|
||||||
|
|
||||||
`UPDATER_TOKEN` should be set as an organisation-level secret in Gitea so all repos share it.
|
|
||||||
|
|
||||||
## Inputs
|
|
||||||
|
|
||||||
| Name | Required | Default | Description |
|
|
||||||
|---|---|---|---|
|
|
||||||
| `endpoint` | yes | — | Full URL to `/update` |
|
|
||||||
| `image` | yes | — | Image reference without tag |
|
|
||||||
| `tag` | no | `""` | Tag that was just pushed (logged for audit) |
|
|
||||||
| `token` | yes | — | Bearer token configured in package-updater |
|
|
||||||
|
|
||||||
## Failure modes
|
|
||||||
|
|
||||||
The step exits non-zero if `package-updater` returns HTTP 4xx or 5xx. This is intentional — the workflow surfaces the deploy failure to whoever pushed.
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
name: "Deploy via package-updater"
|
|
||||||
description: "Notifies package-updater to pull & restart a Docker Compose service"
|
|
||||||
inputs:
|
|
||||||
endpoint:
|
|
||||||
description: "Full URL to /update (e.g. https://updater.example.com/update)"
|
|
||||||
required: true
|
|
||||||
image:
|
|
||||||
description: "Image reference without tag (e.g. registry.example.com/myapp)"
|
|
||||||
required: true
|
|
||||||
tag:
|
|
||||||
description: "Tag that was just pushed (for logging)"
|
|
||||||
required: false
|
|
||||||
default: ""
|
|
||||||
token:
|
|
||||||
description: "Bearer token for package-updater"
|
|
||||||
required: true
|
|
||||||
runs:
|
|
||||||
using: "composite"
|
|
||||||
steps:
|
|
||||||
- name: Trigger update
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TOKEN: ${{ inputs.token }}
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
response=$(curl -sS -w "\n%{http_code}" \
|
|
||||||
-X POST "${{ inputs.endpoint }}" \
|
|
||||||
-H "Authorization: Bearer $TOKEN" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d "{\"image\":\"${{ inputs.image }}\",\"tag\":\"${{ inputs.tag }}\"}")
|
|
||||||
body=$(echo "$response" | head -n -1)
|
|
||||||
code=$(echo "$response" | tail -n 1)
|
|
||||||
echo "HTTP $code"
|
|
||||||
echo "$body" | jq .
|
|
||||||
if [ "$code" -ge 400 ]; then
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
Reference in New Issue
Block a user