diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index f8a9662..72d44d2 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -2,10 +2,16 @@ name: Docker Build and Publish on: push: - branches: ["main"] tags: ["v*.*.*"] pull_request: branches: ["main"] + workflow_call: + inputs: + version: + description: "Semver tag to publish, e.g. v1.2.3. Empty falls back to the git ref." + type: string + required: false + default: "" workflow_dispatch: env: @@ -55,8 +61,8 @@ jobs: type=raw,value=latest,enable={{is_default_branch}} type=ref,event=branch type=ref,event=pr - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{version}},value=${{ inputs.version }} + type=semver,pattern={{major}}.{{minor}},value=${{ inputs.version }} type=sha,format=short - name: Build and push Docker image diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9061c22..6ff19e8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,6 +16,8 @@ permissions: jobs: create-tag: runs-on: ubuntu-latest + outputs: + new_tag: ${{ steps.create_tag.outputs.new_tag }} steps: - name: Checkout uses: actions/checkout@v4 @@ -48,6 +50,13 @@ jobs: git tag ${{ steps.create_tag.outputs.new_tag }} git push origin ${{ steps.create_tag.outputs.new_tag }} + docker: + needs: create-tag + uses: ./.github/workflows/docker-publish.yml + with: + version: ${{ needs.create-tag.outputs.new_tag }} + secrets: inherit + goreleaser: needs: create-tag runs-on: ubuntu-latest