2023-05-20 11:10:00 +02:00
|
|
|
|
|
|
|
name: Create and publish a Docker image
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- 'v*'
|
|
|
|
branches:
|
|
|
|
- 'master'
|
|
|
|
|
|
|
|
env:
|
|
|
|
REGISTRY: ghcr.io
|
|
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-and-push-image:
|
2023-05-20 12:12:50 +02:00
|
|
|
if: github.repository == 'restic/restic'
|
2023-05-20 11:10:00 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
2023-10-01 03:24:05 +02:00
|
|
|
uses: actions/checkout@v4
|
2023-05-20 11:10:00 +02:00
|
|
|
|
|
|
|
- name: Log in to the Container registry
|
2023-09-01 03:45:03 +02:00
|
|
|
uses: docker/login-action@cf8514a65188af1d4f94f8c28a7a4153af1088ce
|
2023-05-20 11:10:00 +02:00
|
|
|
with:
|
|
|
|
registry: ${{ env.REGISTRY }}
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
|
|
|
|
with:
|
|
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
|
|
tags: |
|
|
|
|
type=ref,event=branch
|
|
|
|
type=semver,pattern={{version}}
|
|
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
|
|
|
|
|
|
- name: Set up QEMU
|
2023-10-01 03:24:01 +02:00
|
|
|
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3
|
2023-05-20 11:10:00 +02:00
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
2023-10-01 03:24:10 +02:00
|
|
|
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226
|
2023-05-20 11:10:00 +02:00
|
|
|
|
|
|
|
- name: Build and push Docker image
|
|
|
|
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
|
|
|
|
with:
|
|
|
|
push: true
|
|
|
|
context: .
|
|
|
|
file: docker/Dockerfile.release
|
|
|
|
platforms: linux/386,linux/amd64,linux/arm,linux/arm64
|
|
|
|
pull: true
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|