Skip to content

branch master to latest #249

branch master to latest

branch master to latest #249

Workflow file for this run

name: "Build"
on:
push
jobs:
# build all the image variants
build:
runs-on: ubuntu-latest
steps:
# checkout repo
- uses: actions/checkout@v2
# setup multi-arch build support
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get --yes --no-install-recommends install binfmt-support qemu-user-static
# get branch / tag name
- name: Get Branch / Tag Name
id: get_branch
run: |
export RELEASE_NAME=$(if [[ ${GITHUB_REF} =~ "refs/tags/" ]]; then echo ${GITHUB_REF/refs\/tags\//}; else echo ${GITHUB_REF/refs\/heads\//}; fi)
echo $RELEASE_NAME
echo ::set-output name=NAME::${RELEASE_NAME}
# generate the image tag
- name: Get Image Tag
id: get_tag
run: |
export TARGET_IMAGE_TAG=$(if [ "${{ steps.get_branch.outputs.NAME }}" = "latest" ]; then echo "latest"; else echo "${{ steps.get_branch.outputs.NAME }}"; fi)
echo $TARGET_IMAGE_TAG
echo ::set-output name=NAME::${TARGET_IMAGE_TAG}
# generate the alternative image tag
- name: Get Alternate Tag
id: get_alt_tag
run: |
export ALT_IMAGE_TAG=$(if [ "${{ steps.get_branch.outputs.NAME }}" = "latest" ]; then echo "ubuntu"; else echo "${{ steps.get_branch.outputs.NAME }}-ubuntu"; fi)
echo $ALT_IMAGE_TAG
echo ::set-output name=NAME::${ALT_IMAGE_TAG}
# login to docker hub
- name: Login to Docker Hub
if: github.repository == 'homebridge/docker-homebridge'
run: |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
# login to github container registry
- name: Login to Packages Container registry
uses: docker/login-action@v1
if: github.repository == 'homebridge/docker-homebridge'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# create docker buildx builder
- name: Create docker buildx builder
run: |
docker buildx create --name multibuilder
docker buildx use multibuilder
# build the image for Docker Hub
- name: Build Image For Docker Hub
run: |
docker buildx build --push -f Dockerfile --platform linux/amd64,linux/arm/v7,linux/arm64 -t homebridge/homebridge:${{ steps.get_alt_tag.outputs.NAME }} .
docker buildx build --push -f Dockerfile --platform linux/amd64,linux/arm/v7,linux/arm64 -t homebridge/homebridge:${{ steps.get_tag.outputs.NAME }} .
# build the image for Github Container Registry (will use the cached build from the previous step)
- name: Build Image For Github Container Registry
run: |
docker buildx build --push -f Dockerfile --platform linux/amd64,linux/arm/v7,linux/arm64 -t ghcr.io/homebridge/homebridge:${{ steps.get_alt_tag.outputs.NAME }} .
docker buildx build --push -f Dockerfile --platform linux/amd64,linux/arm/v7,linux/arm64 -t ghcr.io/homebridge/homebridge:${{ steps.get_tag.outputs.NAME }} .