Compare commits
13
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
59c8f57ab2 | ||
|
|
b17c183a00 | ||
|
|
be95ef5b18 | ||
|
|
7b5294dc98 | ||
|
|
9519ff5cb0 | ||
|
|
ffec9c4298 | ||
|
|
b987ab54db | ||
|
|
ae5b4afac9 | ||
|
|
00f7aac8ab | ||
|
|
ef4d89d896 | ||
|
|
863ec9d533 | ||
|
|
ec75d04e07 | ||
|
|
febb03c381 |
@@ -1,45 +1,46 @@
|
||||
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:
|
||||
description: 'name of the dockerimage'
|
||||
required: true
|
||||
default: ${{ github.repository }}
|
||||
type: string
|
||||
checkout:
|
||||
description: 'checkout repo first'
|
||||
default: 'true'
|
||||
type: string
|
||||
tag:
|
||||
description: 'checkout repo first'
|
||||
default: 'true'
|
||||
secrets:
|
||||
TOKEN:
|
||||
description: 'repo auth token'
|
||||
required: true
|
||||
type: string
|
||||
# secrets:
|
||||
# TOKEN:
|
||||
# description: 'repo auth token'
|
||||
# required: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: slim
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
if: ${{ inputs.checkout == 'true' }}
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
fetch-depth: '0'
|
||||
- name: Bump version and push tag
|
||||
id: tag
|
||||
if: ${{ inputs.tag == 'true' }}
|
||||
uses: phadric/github-tag-action@a5250a59655e9f4b0350407380a92c73948f2aec # master
|
||||
uses: anothrNick/github-tag-action@4ed44965e0db8dab2b466a16da04aec3cc312fd8 # 1.75.0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # if you don't want to set write permissions use a PAT token
|
||||
DEFAULT_BUMP: patch
|
||||
@@ -61,7 +62,7 @@ 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@d1b27ffbf29fb93b7239130db030c702198fd52b # v1.64.0
|
||||
id: cache
|
||||
with:
|
||||
image: ${{ inputs.cache-registry }}/${{ inputs.image_name }}-cache
|
||||
@@ -69,7 +70,7 @@ jobs:
|
||||
- name: Setup Docker buildx
|
||||
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
|
||||
- name: Log into registry ${{ inputs.registry }}
|
||||
uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0
|
||||
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
|
||||
with:
|
||||
registry: ${{ inputs.registry }}
|
||||
username: ${{ github.actor }}
|
||||
|
||||
@@ -17,9 +17,11 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
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
|
||||
|
||||
+3
-3
@@ -29,7 +29,7 @@ runs:
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
if: ${{ inputs.checkout == 'true' }}
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
fetch-depth: '0'
|
||||
- name: Bump version and push tag
|
||||
@@ -57,7 +57,7 @@ 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@d1b27ffbf29fb93b7239130db030c702198fd52b # v1.64.0
|
||||
id: cache
|
||||
with:
|
||||
image: ${{ inputs.cache-registry }}/${{ inputs.image_name }}-cache
|
||||
@@ -65,7 +65,7 @@ runs:
|
||||
- name: Setup Docker buildx
|
||||
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
|
||||
- name: Log into registry ${{ inputs.registry }}
|
||||
uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0
|
||||
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
|
||||
with:
|
||||
registry: ${{ inputs.registry }}
|
||||
username: ${{ github.actor }}
|
||||
|
||||
Reference in New Issue
Block a user