📦 NEW: Added API endpoints for querying and Docker image #13
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
#@doc | |
# * This GitHub Actions workflow builds and pushes a Docker image to GitHub Container Registry. | |
# * It is triggered when a branch is created with the name syntax "release/[version]-[channel]". | |
# | |
# The workflow does the following: | |
# 1. Checks out the code, sets up Docker buildx, Login to the registry. | |
# 2. Extracts the branch name from the GITHUB_REF environment variable. | |
# 3. Splits the branch name to get the version and channel. | |
# 4. Builds and pushes the Docker image. | |
# Examples: | |
# If the branch name is 'release/1.0.0-latest', the image is tagged as '1.0.0' and 'latest'. | |
# If the branch name is 'release/1.0.1-stable', the image is tagged as '1.0.1' and 'stable'. | |
# If the branch name is 'release/1.0.2-dev', the image is tagged as '1.0.2-dev'. | |
# | |
# * The 'latest' and 'stable' tags allow us to easily switch between different versions. | |
# * The 'dev' tag allows you to have a separate version for development. | |
name: Build and Push Docker Images | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- "release/*" | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Extract version and release type | |
id: extract_version | |
run: | | |
BRANCH_NAME=${{ github.ref }} | |
VERSION=$(echo $BRANCH_NAME | cut -d'/' -f 3 | cut -d'-' -f 1) | |
RELEASE_TYPE=$(echo $BRANCH_NAME | cut -d'/' -f 3 | cut -d'-' -f 2) | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
echo "release_type=$RELEASE_TYPE" >> $GITHUB_OUTPUT | |
- name: Docker meta for meeseeks-base | |
id: meta_base | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/bearlike/meeseeks-base | |
tags: | | |
type=raw,value=${{ steps.extract_version.outputs.version }}${{ steps.extract_version.outputs.release_type == 'dev' && '-dev' || '' }} | |
type=raw,value=latest,enable=${{ steps.extract_version.outputs.release_type == 'latest' }} | |
type=raw,value=stable,enable=${{ steps.extract_version.outputs.release_type == 'stable' }} | |
type=raw,value=dev,enable=${{ steps.extract_version.outputs.release_type == 'dev' }} | |
- name: Docker meta for meeseeks-chat | |
id: meta_chat | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/bearlike/meeseeks-chat | |
tags: | | |
type=raw,value=${{ steps.extract_version.outputs.version }}${{ steps.extract_version.outputs.release_type == 'dev' && '-dev' || '' }} | |
type=raw,value=latest,enable=${{ steps.extract_version.outputs.release_type == 'latest' }} | |
type=raw,value=stable,enable=${{ steps.extract_version.outputs.release_type == 'stable' }} | |
type=raw,value=dev,enable=${{ steps.extract_version.outputs.release_type == 'dev' }} | |
- name: Docker meta for meeseeks-api | |
id: meta_api | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/bearlike/meeseeks-api | |
tags: | | |
type=raw,value=${{ steps.extract_version.outputs.version }}${{ steps.extract_version.outputs.release_type == 'dev' && '-dev' || '' }} | |
type=raw,value=latest,enable=${{ steps.extract_version.outputs.release_type == 'latest' }} | |
type=raw,value=stable,enable=${{ steps.extract_version.outputs.release_type == 'stable' }} | |
type=raw,value=dev,enable=${{ steps.extract_version.outputs.release_type == 'dev' }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GHCR | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push meeseeks-base | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: Dockerfile.base | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta_base.outputs.tags }} | |
labels: ${{ steps.meta_base.outputs.labels }} | |
- name: Build and push meeseeks-chat | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: Dockerfile.chat | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta_chat.outputs.tags }} | |
labels: ${{ steps.meta_chat.outputs.labels }} | |
build-args: | | |
BASE_IMAGE=ghcr.io/bearlike/meeseeks-base:${{ steps.extract_version.outputs.version }}${{ steps.extract_version.outputs.release_type == 'dev' && '-dev' || '' }} | |
- name: Build and push meeseeks-api | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: Dockerfile.api | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta_api.outputs.tags }} | |
labels: ${{ steps.meta_api.outputs.labels }} | |
build-args: | | |
BASE_IMAGE=ghcr.io/bearlike/meeseeks-base:${{ steps.extract_version.outputs.version }}${{ steps.extract_version.outputs.release_type == 'dev' && '-dev' || '' }} |