release v0.2.0 #5
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: Build and publish Docker image | |
on: | |
push: | |
tags: ["v*"] | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "Version tag for the Docker image (semver)" | |
required: true | |
env: | |
IMAGE_NAME: ${{ github.repository }} | |
VERSION: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version || github.ref_name }} | |
jobs: | |
build-and-push-x64-image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
ghcr.io/${{ env.IMAGE_NAME }} | |
tags: | | |
type=semver,pattern={{version}}${{ github.event_name == 'workflow_dispatch' && format(',value={0}', github.event.inputs.version) || '' }} | |
type=semver,pattern={{major}}.{{minor}}${{ github.event_name == 'workflow_dispatch' && format(',value={0}', github.event.inputs.version) || '' }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# - name: Log in to Dockerhub | |
# uses: docker/login-action@v2 | |
# with: | |
# username: ${{ github.actor }} | |
# password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
platforms: linux/amd64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
create-release: | |
runs-on: ubuntu-latest | |
needs: build-and-push-x64-image | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Create Release | |
id: create_release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ env.VERSION }} | |
prerelease: ${{ contains(env.VERSION, 'alpha') || contains(env.VERSION, 'beta') }} | |
generate_release_notes: true |