Prepare for 8.0 #1775
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 | |
on: | |
# Run when pushes to branch or create new Tag | |
push: | |
branches: | |
- '*' | |
paths-ignore: | |
- 'docs/**' | |
- '*.md' | |
create: | |
tags: | |
- '*' | |
jobs: | |
# define job to build and publish docker image | |
build-and-push-docker-image: | |
name: Build Docker image and push to repositories | |
# run only when code is compiling and tests are passing | |
runs-on: ubuntu-latest | |
# steps to perform in job | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
# setup Docker buld action | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Extract branch name | |
shell: bash | |
run: | | |
TAG="latest" | |
case $GITHUB_REF in refs/heads/*) | |
TAG=${GITHUB_REF#refs/heads/};; | |
esac | |
case $GITHUB_REF in refs/tags/*) | |
TAG=${GITHUB_REF#refs/tags/}; | |
esac | |
echo "##[set-output name=branch;]$TAG" | |
id: extract_branch | |
- name: PrepareReg Names | |
shell: bash | |
run: echo IMAGE_REPOSITORY=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV | |
id: extract_repository | |
- name: Build image and push to Docker Hub | |
uses: docker/build-push-action@v4 | |
with: | |
# relative path to the place where source code with Dockerfile is located | |
context: . | |
file: ./Docker/Dockerfile | |
build-args: "FPPBRANCH=${{ steps.extract_branch.outputs.branch }}" | |
# Note: tags has to be all lower-case | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
tags: ${{ env.IMAGE_REPOSITORY }}/fpp:${{ steps.extract_branch.outputs.branch }},${{ env.IMAGE_REPOSITORY }}/fpp:latest | |
push: true | |
cache-from: type=registry,ref=${{ env.IMAGE_REPOSITORY }}/fpp:master | |
cache-to: type=inline | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} |