63 lines
2.3 KiB
YAML
63 lines
2.3 KiB
YAML
name: Build and push (standalone)
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
PACKAGE_WRITER_USERNAME:
|
|
required: true
|
|
type: string
|
|
jobs:
|
|
build_and_push:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Set current time
|
|
uses: https://github.com/gerred/actions/current-time@master
|
|
id: current_time
|
|
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: |
|
|
${{ vars.IMAGE_PATH }}
|
|
tags: |
|
|
type=ref,event=branch,branch=dev,suffix=-{{sha}},optional=true
|
|
type=ref,event=branch,branch=dev,value=dev,optional=true
|
|
type=match,event=tag,pattern=v(.*),group=1,prefix=v,optional=true
|
|
type=match,event=tag,pattern=v(.*),value=latest,optional=true
|
|
flavor: |
|
|
latest=false
|
|
|
|
- name: Print (debug) Docker meta JSON
|
|
uses: https://github.com/actions/github-script@v7
|
|
with:
|
|
script: |
|
|
const json = JSON.parse(process.env.JSON_STRING);
|
|
console.log("------------------------------------------------------------");
|
|
console.log("Docker Meta JSON Output:");
|
|
console.log("");
|
|
console.log(JSON.stringify(json, null, 2));
|
|
console.log("");
|
|
console.log("------------------------------------------------------------");
|
|
env:
|
|
JSON_STRING: ${{ steps.meta.outputs.json }}
|
|
|
|
- name: Login into gitea registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: git.kvant.cloud
|
|
username: ${{ inputs.PACKAGE_WRITER_USERNAME }}
|
|
password: ${{ secrets.PACKAGE_WRITER_TOKEN }}
|
|
|
|
- name: Build container and push to registry
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
push: true
|
|
file: ./docker/Dockerfile
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
build-args: |
|
|
progress=plain
|
|
FONTAWESOME_PACKAGE_TOKEN=${{ secrets.FONTAWESOME_PACKAGE_TOKEN }}
|
|
IMAGE_TAG=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
|
|
VCS_REF=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
|
|
BUILD_DATE=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
|