Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a3da62aa70 | ||
|
|
9519ff5cb0 | ||
|
|
ffec9c4298 | ||
|
|
b987ab54db | ||
|
|
ae5b4afac9 | ||
|
|
00f7aac8ab |
@@ -1,17 +1,14 @@
|
||||
name: 'Tag Build and Push Docker image'
|
||||
description: 'Tags version in current repo, builds docker image and pushes it to registry'
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
registry: # id of input
|
||||
description: 'docker regisry host name'
|
||||
required: true
|
||||
type: string
|
||||
default: 'gitea.phadric.de'
|
||||
cache-registry: # id of input
|
||||
description: 'docker regisry host name'
|
||||
required: true
|
||||
default: 'imagecache.phadric.de'
|
||||
type: string
|
||||
image_name:
|
||||
@@ -37,7 +34,7 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
if: ${{ inputs.checkout == 'true' }}
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
fetch-depth: '0'
|
||||
- name: Bump version and push tag
|
||||
@@ -53,7 +50,7 @@ jobs:
|
||||
PRERELEASE_SUFFIX: ${{ github.ref_name }}
|
||||
- name: Extract Docker metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
|
||||
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
|
||||
with:
|
||||
flavor: |
|
||||
latest=${{ github.ref_name == 'main' || github.ref_name == 'master' }}
|
||||
@@ -65,22 +62,22 @@ jobs:
|
||||
# disabled if major zero
|
||||
type=semver,pattern={{major}},value=${{steps.tag.outputs.tag}},enable=${{ !startsWith(steps.tag.outputs.tag, 'v0.') }}
|
||||
images: ${{ inputs.registry }}/${{ inputs.image_name }}
|
||||
- uses: int128/docker-build-cache-config-action@6b41b75cecc2e81696c50ae7c6c0300b51c2bee1 # v1.62.0
|
||||
- uses: int128/docker-build-cache-config-action@5a7737d035432c268b2b5bfbbcb32e02804c3729 # v1.63.0
|
||||
id: cache
|
||||
with:
|
||||
image: ${{ inputs.cache-registry }}/${{ inputs.image_name }}-cache
|
||||
extra-cache-to: image-manifest=true
|
||||
- name: Setup Docker buildx
|
||||
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
|
||||
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
|
||||
- name: Log into registry ${{ inputs.registry }}
|
||||
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
|
||||
uses: docker/login-action@06fb636fac595d6fb4b28a5dfcb21a6f5091859c # v4.5.0
|
||||
with:
|
||||
registry: ${{ inputs.registry }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.TOKEN }}
|
||||
- name: Build and push Docker image
|
||||
id: build-and-push
|
||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
|
||||
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
|
||||
@@ -17,9 +17,11 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- name: Verify Action
|
||||
run: actionlint -ignore 'unexpected key "description" for "workflow" section' -ignore 'nexpected key "inputs" for "workflow" section.' -ignore 'unexpected key "runs" for "workflow" section.' -ignore '"on" section is missing in workflow' -ignore '"jobs" section is missing in workflow' action.yml
|
||||
- name: Verify Workflow
|
||||
run: actionlint -ignore 'label "slim" is unknown' .github/workflows/docker-build.yml
|
||||
- name: tag latest after success
|
||||
if: github.ref == 'refs/heads/main'
|
||||
id: tag
|
||||
|
||||
+6
-6
@@ -29,7 +29,7 @@ runs:
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
if: ${{ inputs.checkout == 'true' }}
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
fetch-depth: '0'
|
||||
- name: Bump version and push tag
|
||||
@@ -45,7 +45,7 @@ runs:
|
||||
PRERELEASE_SUFFIX: ${{ github.ref_name }}
|
||||
- name: Extract Docker metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
|
||||
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
|
||||
with:
|
||||
flavor: |
|
||||
latest=${{ github.ref_name == 'main' || github.ref_name == 'master' }}
|
||||
@@ -57,22 +57,22 @@ runs:
|
||||
# disabled if major zero
|
||||
type=semver,pattern={{major}},value=${{steps.tag.outputs.tag}},enable=${{ !startsWith(steps.tag.outputs.tag, 'v0.') }}
|
||||
images: ${{ inputs.registry }}/${{ inputs.image_name }}
|
||||
- uses: int128/docker-build-cache-config-action@6b41b75cecc2e81696c50ae7c6c0300b51c2bee1 # v1.62.0
|
||||
- uses: int128/docker-build-cache-config-action@5a7737d035432c268b2b5bfbbcb32e02804c3729 # v1.63.0
|
||||
id: cache
|
||||
with:
|
||||
image: ${{ inputs.cache-registry }}/${{ inputs.image_name }}-cache
|
||||
extra-cache-to: image-manifest=true
|
||||
- name: Setup Docker buildx
|
||||
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
|
||||
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
|
||||
- name: Log into registry ${{ inputs.registry }}
|
||||
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
|
||||
uses: docker/login-action@06fb636fac595d6fb4b28a5dfcb21a6f5091859c # v4.5.0
|
||||
with:
|
||||
registry: ${{ inputs.registry }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ inputs.token }}
|
||||
- name: Build and push Docker image
|
||||
id: build-and-push
|
||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
|
||||
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
|
||||
Reference in New Issue
Block a user