Skip to content

Commit

Permalink
ci: create release docker image through workflow-call (#1246)
Browse files Browse the repository at this point in the history
  • Loading branch information
zerok authored Nov 25, 2024
1 parent 7fdc5e1 commit fb6380f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@ on:
push:
branches:
- main
tags:
- v*
pull_request:
branches:
- "*"
paths-ignore:
- "docs/**"
- ".github/workflows/publish-page.yml"
merge_group:
merge_group: {}
workflow_call:
inputs:
tag:
type: string
required: true

permissions:
contents: read
Expand All @@ -23,9 +26,9 @@ env:
REGISTRY_IMAGE: grafana/tanka
# Docker image tags. See https://github.com/docker/metadata-action for format
TAGS_CONFIG: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=sha,prefix={{branch}}-,format=short,enable=${{ github.ref == 'refs/heads/main' }}
type=semver,pattern={{version}}
type=raw,value=latest,enable=${{ inputs.tag != '' }}
type=semver,pattern={{version}},value=${{ inputs.tag }},enable=${{ inputs.tag != '' }}
jobs:
build:
Expand All @@ -41,6 +44,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Docker meta
id: meta
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ jobs:
manifest-file: .release-please-manifest.json
github-token: ${{ github.secret }}

release-docker-image:
needs:
- release-please
if: needs.release-please.outputs.release_created
permissions:
contents: write
pull-requests: write
id-token: write
uses: ./.github/workflows/docker.yml
with:
tag: ${{ needs.release-please.outputs.release_tag }}

# If a release was created, also create the binaries and attach them
release-binaries:
runs-on: ubuntu-latest
Expand Down

0 comments on commit fb6380f

Please sign in to comment.