5.0.0 / 2023-11-03 #6
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create Release and Push to Container Registries | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: The tag to publish | |
required: true | |
jobs: | |
make-release: | |
runs-on: ubuntu-latest | |
name: Create Release | |
steps: | |
- uses: actions/checkout@v4 | |
if: github.event_name == 'push' | |
- uses: actions/checkout@v4 | |
if: github.event_name == 'workflow_dispatch' | |
with: | |
ref: refs/tags/${{ github.event.inputs.tag }} | |
- uses: ghalactic/github-release-from-tag@v5 | |
with: | |
summaryEnabled: false | |
publish-image: | |
name: Build and Push to Docker Hub | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
if: github.event_name == 'push' | |
- uses: actions/checkout@v4 | |
if: github.event_name == 'workflow_dispatch' | |
with: | |
ref: refs/tags/${{ github.event.inputs.tag }} | |
- uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- id: meta | |
uses: docker/[email protected] | |
with: | |
images: | | |
kineticcafe/ansible | |
ghcr.io/kineticcafe/ansible | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
- uses: docker/[email protected] | |
- uses: docker/[email protected] | |
- id: docker_build | |
uses: docker/[email protected] | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: | | |
linux/amd64 | |
linux/arm64 | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- uses: peter-evans/[email protected] | |
with: | |
repository: kineticcafe/ansible | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} |