Skip to content

Merge pull request #12 from XLixl4snSU/dev #21

Merge pull request #12 from XLixl4snSU/dev

Merge pull request #12 from XLixl4snSU/dev #21

Workflow file for this run

name: Docker
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on:
push:
branches: [ "release/*" ]
# Publish tags as releases.
tags: [ 'v*.*.*','latest' ]
workflow_dispatch:
env:
# Use docker.io for Docker Hub if empty
REGISTRY: docker.io
# github.repository as <account>/<repo>
IMAGE_NAME: butti/sftp-backup-logs
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: butti
password: ${{ secrets.DOCKER_PW }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract ghcr.io metadata
id: meta-ghcr
uses: docker/metadata-action@v4
with:
images: ghcr.io/XLixl4snSU/sftp-backup-logs
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v3
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}, ${{ steps.meta-ghcr.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Docker Hub Description
id: description
uses: peter-evans/dockerhub-description@v3
with:
username: butti
password: ${{ secrets.DOCKER_PW }}
repository: ${{ env.IMAGE_NAME }}
short-description: ${{ github.event.repository.description }}