Improved docker push github action #59
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: | |
branches: [ master ] | |
release: | |
types: [ created ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Checkout GitHub Action' | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Docker hub meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
flavor: | | |
latest=true | |
tags: | | |
type=semver,pattern=v{{version}} | |
type=ref,event=push | |
type=sha | |
images: ${{ github.actor }}/prometheus-qbittorrent-exporter | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
- name: Build and push docker to DockerHub | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
platforms: linux/amd64,linux/arm64,linux/386 | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: GHCR Docker meta | |
id: metaghcr | |
uses: docker/metadata-action@v5 | |
with: | |
flavor: | | |
latest=true | |
tags: | | |
type=semver,pattern=v{{version}} | |
type=ref,event=push | |
type=sha | |
images: ${{ github.actor }}/prometheus-qbittorrent-exporter | |
- name: Login to Github Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push docker to Github Container Registry | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
platforms: linux/amd64,linux/arm64,linux/386 | |
tags: ${{ steps.metaghcr.outputs.tags }} | |
labels: ${{ steps.metaghcr.outputs.labels }} |