Refactor docker workflow
This commit is contained in:
@@ -1,60 +0,0 @@
|
|||||||
# https://github.com/home-assistant/builder
|
|
||||||
name: 'Builder'
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags: [ 'v*' ]
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
hassio:
|
|
||||||
name: Hassio Addon
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout the repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Login to DockerHub
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Branch name
|
|
||||||
run: |
|
|
||||||
VERSION="${GITHUB_REF#refs/tags/v}"
|
|
||||||
VERSION="${VERSION#refs/heads/}"
|
|
||||||
echo "REPO=alexxit/go2rtc" >> $GITHUB_ENV
|
|
||||||
echo "TAG=${VERSION}" >> $GITHUB_ENV
|
|
||||||
echo "IMAGE=alexxit/go2rtc:${VERSION}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Build amd64
|
|
||||||
uses: home-assistant/builder@master
|
|
||||||
with:
|
|
||||||
args: --amd64 --target . --version $TAG-amd64 --no-latest --docker-hub-check
|
|
||||||
|
|
||||||
- name: Build i386
|
|
||||||
uses: home-assistant/builder@master
|
|
||||||
with:
|
|
||||||
args: --i386 --target . --version $TAG-i386 --no-latest --docker-hub-check
|
|
||||||
|
|
||||||
- name: Build aarch64
|
|
||||||
uses: home-assistant/builder@master
|
|
||||||
with:
|
|
||||||
args: --aarch64 --target . --version $TAG-aarch64 --no-latest --docker-hub-check
|
|
||||||
|
|
||||||
- name: Build armv7
|
|
||||||
uses: home-assistant/builder@master
|
|
||||||
with:
|
|
||||||
args: --armv7 --target . --version $TAG-armv7 --no-latest --docker-hub-check
|
|
||||||
|
|
||||||
- name: Docker manifest
|
|
||||||
run: |
|
|
||||||
# thanks to https://github.com/aler9/rtsp-simple-server/blob/main/Makefile
|
|
||||||
docker manifest create "${IMAGE}" \
|
|
||||||
"${IMAGE}-amd64" "${IMAGE}-i386" "${IMAGE}-aarch64" "${IMAGE}-armv7"
|
|
||||||
docker manifest push "${IMAGE}"
|
|
||||||
|
|
||||||
docker manifest create "${REPO}:latest" \
|
|
||||||
"${IMAGE}-amd64" "${IMAGE}-i386" "${IMAGE}-aarch64" "${IMAGE}-armv7"
|
|
||||||
docker manifest push "${REPO}:latest"
|
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
name: ci
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v4
|
||||||
|
with:
|
||||||
|
images: alexxit/go2rtc
|
||||||
|
tags: |
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=pr
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
Reference in New Issue
Block a user