This commit is contained in:
vodyanoysh 2026-04-22 19:35:51 +07:00
parent 1b6ef06d21
commit 93934f785f
2 changed files with 14 additions and 12 deletions

View file

@ -3,9 +3,6 @@ name: Reusable Docker Build
on: on:
workflow_call: workflow_call:
inputs: inputs:
image_name:
required: true
type: string
context: context:
required: false required: false
type: string type: string
@ -14,11 +11,6 @@ on:
required: false required: false
type: string type: string
default: "./Dockerfile" default: "./Dockerfile"
secrets:
REGISTRY_USERNAME:
required: true
REGISTRY_TOKEN:
required: true
jobs: jobs:
build: build:
@ -36,7 +28,7 @@ jobs:
id: meta id: meta
uses: docker/metadata-action@v5 uses: docker/metadata-action@v5
with: with:
images: git.vodyanoysh.ru/${{ inputs.image_name }} images: git.vodyanoysh.ru/system/${{ github.repository }}
tags: | tags: |
type=ref,event=branch type=ref,event=branch
type=ref,event=pr type=ref,event=pr
@ -58,4 +50,4 @@ jobs:
file: ${{ inputs.dockerfile }} file: ${{ inputs.dockerfile }}
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}

View file

@ -1,5 +1,7 @@
usage: ## Usage
In your project's `.forgejo/workflows/build.yml`:
```yaml ```yaml
name: Build name: Build
@ -13,7 +15,15 @@ on:
jobs: jobs:
docker-build: docker-build:
uses: vodyanoy/ci-workflows/.forgejo/workflows/docker-build.yml@master uses: vodyanoy/ci-workflows/.forgejo/workflows/docker-build.yml@master
with:
image_name: vodyanoy/your-project # required: org/repo as it appears in the registry
secrets: secrets:
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }} REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }} REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
``` ```
### Available workflows
| Workflow | Trigger | Inputs | Secrets |
|---|---|---|---|
| `docker-build.yml` | `workflow_call` | `image_name` (required), `context` (default `.`), `dockerfile` (default `./Dockerfile`) | `REGISTRY_USERNAME`, `REGISTRY_TOKEN` |