This repository has been archived by the owner on Mar 22, 2024. It is now read-only.
Docker Build #5
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: Publish Release | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: "version" | |
required: false | |
type: string | |
release: | |
types: | |
- created | |
jobs: | |
build_docker_release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: "main" | |
fetch-depth: 0 | |
- name: Release tag | |
id: releasetag | |
run: | | |
if [ -z "${{ inputs.tag }}" ]; then | |
latest_release_tag=$(curl -s "https://api.github.com/repos/${{ github.repository_owner }}/${{ github.event.repository.name }}/releases/latest" | jq -r .tag_name) | |
echo "release_tag=${latest_release_tag}" >> $GITHUB_ENV | |
else | |
echo "release_tag=${{ inputs.tag }}" >> $GITHUB_ENV | |
fi | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }} | |
tags: | | |
type=raw,value=latest,enable=true | |
type=sha | |
type=raw,value=${{ steps.releasetag.outputs.release_tag }},enable=true | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GH_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./ | |
platforms: linux/arm/v7,linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |