Skip to content

Discord Webhooks

Discord Webhooks #267

Workflow file for this run

name: "Build"
on:
push
jobs:
# build all the image variants
build:
runs-on: ubuntu-latest
steps:
# checkout repo
- name: Checkout
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: Get branch/tag name
id: get_branch
run: |
export BRANCH_NAME=$(echo "${{ github.ref }}" | sed -e "s/refs\/heads\///g" -e "s/refs\/tags\///g")
echo $BRANCH_NAME
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_OUTPUT
- name: Set image tag
id: image_tag
run: |
export IMAGE_TAG=$(if [[ "${{ steps.get_branch.outputs.BRANCH_NAME }}" =~ (latest|master|main) ]]; then echo "latest"; else echo "${{ steps.get_branch.outputs.BRANCH_NAME }}"; fi)
echo $IMAGE_TAG
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_OUTPUT
- name: Set alternate image tag
id: alt_image_tag
run: |
export ALT_IMAGE_TAG=$(if [[ "${{ steps.get_branch.outputs.BRANCH_NAME }}" =~ (latest|master|main) ]]; then echo "ubuntu"; else echo "${{ steps.get_branch.outputs.BRANCH_NAME }}-ubuntu"; fi)
echo $ALT_IMAGE_TAG
echo "ALT_IMAGE_TAG=${ALT_IMAGE_TAG}" >> $GITHUB_OUTPUT
- name: Set versioned image tag
id: versioned_image_tag
run: |
export FORMATED_DATE=`date +%Y-%m-%d`
export VERSION_IMAGE_TAG=$(if [[ "${{ steps.get_branch.outputs.BRANCH_NAME }}" =~ (latest|master|main) ]]; then echo ${FORMATED_DATE}; else echo "${{ steps.get_branch.outputs.BRANCH_NAME }}-${FORMATED_DATE}"; fi)
echo $VERSION_IMAGE_TAG
echo "VERSION_IMAGE_TAG=${VERSION_IMAGE_TAG}" >> $GITHUB_OUTPUT
- name: Log into GitHub Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Image to GitHub Container Registry
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
tags: |
ghcr.io/homebridge/homebridge:${{ steps.image_tag.outputs.IMAGE_TAG }}
ghcr.io/homebridge/homebridge:${{ steps.alt_image_tag.outputs.ALT_IMAGE_TAG }}
ghcr.io/homebridge/homebridge:${{ steps.versioned_image_tag.outputs.VERSION_IMAGE_TAG }}
- name: Log into Docker Hub
uses: docker/login-action@v3
if: github.repository == 'homebridge/docker-homebridge'
with:
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and Push Image to Docker Hub
uses: docker/build-push-action@v5
if: github.repository == 'homebridge/docker-homebridge'
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
tags: |
homebridge/homebridge:${{ steps.image_tag.outputs.IMAGE_TAG }}
homebridge/homebridge:${{ steps.alt_image_tag.outputs.ALT_IMAGE_TAG }}
homebridge/homebridge:${{ steps.versioned_image_tag.outputs.VERSION_IMAGE_TAG }}