This repository has been archived by the owner on Feb 18, 2024. It is now read-only.
Docker #827
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: Docker | |
on: | |
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@v3 | |
- name: Create VERSION file | |
run: | | |
VERSION="${{ github.sha }}" | |
echo "${VERSION:0:7}" > VERSION | |
- name: Log into the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata for the Docker image | |
id: meta | |
uses: docker/metadata-action@v4 | |
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@v4 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |