51 lines
1.3 KiB
YAML
Executable File
51 lines
1.3 KiB
YAML
Executable File
name: Docker
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 6 * * 0'
|
|
push:
|
|
branches: [ "main" ]
|
|
tags: [ 'v*.*.*' ]
|
|
pull_request:
|
|
branches: [ "main" ]
|
|
|
|
env:
|
|
# Use docker.io or ghcr.io
|
|
REGISTRY: docker.io
|
|
RELEASE: latest
|
|
USER: sthopeless
|
|
IMAGE: ${{ github.repository.split('/')[1] }}
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log into registry ${{ env.REGISTRY }}
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ secrets.DOCKER_USER }}
|
|
password: ${{ secrets.DOCKER_PASS }}
|
|
|
|
- name: Extract repository name
|
|
if: ${{ env.REGISTRY == 'docker.io' }}
|
|
id: repo_name
|
|
run: echo "IMAGE_NAME=${{ env.USER }}/${{ env.IMAGE }}:${{ env.RELEASE }}" >> $GITHUB_ENV
|
|
|
|
- name: Extract repository name
|
|
if: ${{ env.REGISTRY == 'ghcr.io' }}
|
|
id: repo_name
|
|
run: echo "IMAGE_NAME=${{ env.REGISTRY }}/${{ env.USER }}/${{ env.IMAGE }}:${{ env.RELEASE }}" >> $GITHUB_ENV
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
file: Dockerfile
|
|
push: true
|
|
tags: ${{ env.IMAGE_NAME }}
|