Jafner.net/5etools-docker/.github/workflows/ci_cd.yml

69 lines
2.1 KiB
YAML

name: CI/CD
on:
# Triggers the workflow when changes are made to the image on the main branch
push:
branches: [ main ]
paths-ignore: # don't run this workflow if no changes have been made to the docker image
- '.github/**'
- 'docker-compose.yml'
- 'README.md'
pull_request:
branches: [ main ]
paths-ignore: # don't run this workflow if no changes have been made to the docker image
- '.github/**'
- 'docker-compose.yml'
- 'README.md'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
ci:
name: Build and push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Log into Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: jafner/5etools-docker
tags: |
latest
type=edge
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Build and push the Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: jafner/5etools-docker