feat: Add actions workflow using Docker bake file
This commit is contained in:
parent
15bf56a1e7
commit
da9a0bca3d
2 changed files with 57 additions and 2 deletions
55
.forgejo/workflows/bake.yml
Normal file
55
.forgejo/workflows/bake.yml
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'ci-test'
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
paths:
|
||||||
|
- '**.go'
|
||||||
|
- '**.html'
|
||||||
|
- 'Dockerfile'
|
||||||
|
- 'Dockerfile.*'
|
||||||
|
- 'docker-bake.hcl'
|
||||||
|
- '.forgejo/workflows/*.yml'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
bake:
|
||||||
|
runs-on: docker
|
||||||
|
steps:
|
||||||
|
- name: Prepare Registry FQDN
|
||||||
|
id: registry
|
||||||
|
run: |
|
||||||
|
registry=${{ github.server_url }}
|
||||||
|
registry=${registry##http*://}
|
||||||
|
echo "registry=${registry}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Login to Container Registry
|
||||||
|
uses: https://code.forgejo.org/docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ steps.registry.outputs.registry }}
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.TOKEN }}
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: https://code.forgejo.org/actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: https://code.forgejo.org/docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Extract metadata
|
||||||
|
id: meta
|
||||||
|
uses: https://code.forgejo.org/docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
tags: |
|
||||||
|
type=ref,event=branch
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: https://code.forgejo.org/docker/bake-action@v6
|
||||||
|
with:
|
||||||
|
source: .
|
||||||
|
env:
|
||||||
|
TAG: ${{ steps.meta.outputs.tags }}
|
|
@ -8,8 +8,8 @@ variable "TAG" {
|
||||||
function "generate_tags" {
|
function "generate_tags" {
|
||||||
params = [images, versions]
|
params = [images, versions]
|
||||||
result = distinct(flatten(
|
result = distinct(flatten(
|
||||||
[for i in split(",", images) :
|
[for i in split(",", replace(images, "\n", ",")) :
|
||||||
[for v in split(",", versions) :
|
[for v in split(",", replace(versions, "\n", ",")) :
|
||||||
"${i}:${v}"
|
"${i}:${v}"
|
||||||
]
|
]
|
||||||
]))
|
]))
|
||||||
|
|
Loading…
Add table
Reference in a new issue