Skip to content

Build and release docker image #20

Build and release docker image

Build and release docker image #20

name: Build and release docker image
on:
schedule:
- cron: "0 23 * * 1"
push:
branches:
- "**"
tags:
- "v*.*.*"
env:
REGISTRY: ghcr.io
IMAGE: ghcr.io/${{ github.repository }}
GIT_SSL_NO_VERIFY: 1
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta
# save the env to meta tag
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/${{ github.repository }}
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=${{ github.ref_name }}-${{ github.sha }}
- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64, linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: COPY CONTAINER IMAGE NAME
run: |
echo "## :whale: There are available new images:" >> $GITHUB_STEP_SUMMARY