This repository has been archived by the owner on May 7, 2023. It is now read-only.
build and publish docker image #285
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: build and publish docker image | |
on: | |
schedule: | |
- cron: '0 4 * * *' # everyday at 4am utc | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v3 | |
- name: set up qemu | |
uses: docker/setup-qemu-action@v2 | |
- name: set up buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: cache docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: login to docker hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }} | |
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }} | |
- name: login to github container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.GH_REGISTRY_USERNAME }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
dotwee/adb-mqtt-bridge | |
ghcr.io/dotwee/adb-mqtt-bridge | |
flavor: | | |
latest=${{ github.event_name == 'push' }} | |
tags: | | |
type=raw,value=${{ github.sha }} | |
labels: | | |
maintainer=Lukas Wolfsteiner <lukas@wolfsteiner.media> | |
org.opencontainers.image.title=adb-mqtt-bridge | |
org.opencontainers.image.source=https://github.com/dotWee/docker-adb-mqtt-bridge | |
- name: build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |