Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c7554bee64 |
@@ -0,0 +1,76 @@
|
|||||||
|
name: build
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
ref:
|
||||||
|
description: Git ref to build
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
image_name:
|
||||||
|
description: Image name (e.g. admin/reverseproxy)
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
push_stackfile:
|
||||||
|
description: Upload rendered stack-compose as artifact (true/false)
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: "true"
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
ref:
|
||||||
|
description: Git ref to build
|
||||||
|
required: true
|
||||||
|
image_name:
|
||||||
|
description: Image name
|
||||||
|
default: admin/reverseproxy
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
image_tag: ${{ steps.tag.outputs.value }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ inputs.ref }}
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Resolve image tag
|
||||||
|
id: tag
|
||||||
|
run: echo "value=auto-${{ inputs.ref }}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Login to Gitea Container Registry
|
||||||
|
run: |
|
||||||
|
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login "gitea.rudolf.keenetic.link" -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Build and push image
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
gitea.rudolf.keenetic.link/${{ inputs.image_name }}:${{ steps.tag.outputs.value }}
|
||||||
|
gitea.rudolf.keenetic.link/${{ inputs.image_name }}:latest
|
||||||
|
cache-from: type=registry,ref=gitea.rudolf.keenetic.link/${{ inputs.image_name }}:buildcache
|
||||||
|
cache-to: type=registry,ref=gitea.rudolf.keenetic.link/${{ inputs.image_name }}:buildcache,mode=max
|
||||||
|
|
||||||
|
- name: Render stackfile with image tag
|
||||||
|
if: inputs.push_stackfile == 'true'
|
||||||
|
run: |
|
||||||
|
mkdir -p out
|
||||||
|
sed "s|\${version}|${{ steps.tag.outputs.value }}|g" docker-compose.yml > "out/docker-compose-${{ steps.tag.outputs.value }}.yml"
|
||||||
|
|
||||||
|
- name: Upload rendered stackfile as artifact
|
||||||
|
if: inputs.push_stackfile == 'true'
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: stack-compose
|
||||||
|
path: out/
|
||||||
Reference in New Issue
Block a user