Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Docker

Docker #1081

name: Docker
on:
workflow_dispatch: ~
push: ~
schedule:
- cron: '0 17 * * *'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}/bot
jobs:
push:
runs-on: ubuntu-latest
name: Build and Push container
permissions:
packages: write
steps:
- uses: actions/checkout@v4
- name: Create VERSION file
run: |
VERSION="${{ github.sha }}"
echo "${VERSION:0:7}" > VERSION
- name: Log into the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for the Docker image
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
# set latest tag for default branch
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=branch
type=ref,event=pr
- name: Build and push the Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}