Skip to content

moosez-v.3.0.6

moosez-v.3.0.6 #3

Workflow file for this run

name: Build and Push Docker Image
on:
release:
types: [published] # Trigger the workflow on published releases
jobs:
build-and-push:
runs-on: ubuntu-latest # Use the latest Ubuntu runner
steps:
- name: Checkout the code
uses: actions/checkout@v3 # Check out the repository code
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 # Set up Docker Buildx for multi-platform builds
- name: Log in to Docker Hub
uses: docker/login-action@v2 # Log in to Docker Hub using GitHub secrets
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract version from tag
id: extract_version # Extract the version number and fix format
run: |
# Extract version by removing "moosez-" and replacing ".0." with "0."
VERSION=$(echo ${GITHUB_REF##*/} | sed -E 's/moosez-v\.([0-9]+\.[0-9]+\.[0-9]+)/v\1/')
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Build and push Docker image
uses: docker/build-push-action@v5 # Build and push the Docker image
with:
context: . # Build context (current directory)
file: ./Dockerfile # Path to the Dockerfile
push: true # Push the image to Docker Hub
tags: | # Tags for the Docker image
${{ secrets.DOCKER_USERNAME }}/moosez:${{ env.VERSION }}
${{ secrets.DOCKER_USERNAME }}/moosez:latest