release_containers #14
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: release_containers | |
on: | |
workflow_dispatch: | |
inputs: | |
checkout_latest: | |
description: 'Checkout latest tag' | |
required: true | |
type: boolean | |
default: true | |
push: | |
tags: | |
- "[0-9]+.[0-9]+.[0-9]+" | |
jobs: | |
release_ghcr: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Checkout latest release tag | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) | |
echo "TAG_VERSION=$LATEST_TAG" >> $GITHUB_ENV | |
[[ "${{ inputs.checkout_latest }}" == "true" ]] && git checkout $LATEST_TAG || true | |
- name: Get push tag version | |
if: github.event_name == 'push' | |
run: echo "TAG_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Publish Docker image to GitHub Container Registry | |
uses: elgohr/Publish-Docker-Github-Action@v5 | |
with: | |
name: ${{ github.repository }} | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
tags: "latest,${{ env.TAG_VERSION }}" | |
platforms: linux/amd64,linux/arm64 | |
release_docker: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Checkout latest release tag | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) | |
echo "TAG_VERSION=$LATEST_TAG" >> $GITHUB_ENV | |
[[ "${{ inputs.checkout_latest }}" == "true" ]] && git checkout $LATEST_TAG || true | |
- name: Get push tag version | |
if: github.event_name == 'push' | |
run: echo "TAG_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Publish Docker image to Docker Container Registry | |
uses: elgohr/Publish-Docker-Github-Action@v5 | |
with: | |
name: ${{ github.repository }} | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
tags: "latest,${{ env.TAG_VERSION }}" | |
platforms: linux/amd64,linux/arm64 | |
- name: Update Docker Hub Description | |
uses: peter-evans/dockerhub-description@v3 | |
with: | |
repository: ${{ github.repository }} | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} |