chore(release): prepare for v1.0.4 #29
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: Docker Workflow | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: "Tag to simulate" | |
required: true | |
push: | |
tags: | |
- "v*" | |
permissions: # Add the permissions field here | |
contents: read | |
packages: write | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
env: | |
PLATFORMS: linux/amd64, linux/arm64 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Determine Tag Name | |
run: | | |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
echo "tag=${{ github.event.inputs.tag }}" >> $GITHUB_ENV | |
else | |
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
fi | |
- name: Determine if latest tag | |
run: | | |
current_tag=${{ env.tag }} | |
# Fetch all tags, exclude alpha and beta, include the current tag in comparison | |
all_tags=$(git tag -l | grep -v -E 'alpha|beta'; echo "$current_tag") | |
latest_stable_tag=$(echo "$all_tags" | sort -V | tail -n1) | |
if [[ "$current_tag" == "$latest_stable_tag" && ! "$current_tag" =~ alpha|beta ]]; then | |
echo "is_latest=true" >> $GITHUB_ENV | |
else | |
echo "is_latest=false" >> $GITHUB_ENV | |
fi | |
- name: Lowercase Repository Name | |
run: echo "lowercase_repo=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
- name: Build and push image with latest tag | |
if: env.is_latest == 'true' | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: | | |
ghcr.io/${{ env.lowercase_repo }}:${{ env.tag }} | |
ghcr.io/${{ env.lowercase_repo }}:latest | |
platforms: ${{ env.PLATFORMS }} | |
- name: Build and push image without latest tag | |
if: env.is_latest != 'true' | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: ghcr.io/${{ env.lowercase_repo }}:${{ env.tag }} | |
platforms: ${{ env.PLATFORMS }} |