Bump docker/build-push-action from 6.10.0 to 6.11.0 #299
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 Deploy image | |
on: | |
push: | |
env: | |
PLATFORMS: "linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6,linux/ppc64le" | |
IMAGE_NAME: "torrentmonitor" | |
jobs: | |
update_config_build_and_deploy: | |
name: Build and publish Docker image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get branch name | |
id: git | |
shell: bash | |
run: | | |
IS_TAG=false | |
if [[ ${GITHUB_REF} == *"/tags/"* ]]; then | |
IS_TAG=true | |
fi | |
BRANCH_NAME=$(echo ${GITHUB_REF} | sed -e "s/.*\///g") | |
if [[ ${BRANCH_NAME} == "master" ]]; then | |
IMAGE_TAG="devel" | |
else | |
IMAGE_TAG=${BRANCH_NAME} | |
fi | |
echo "image_tag=${IMAGE_TAG}" >> $GITHUB_ENV | |
echo "is_tag=${IS_TAG}" >> $GITHUB_ENV | |
echo "Action branch=${BRANCH_NAME} tag=${IS_TAG} ref=${GITHUB_REF} image_tag=${IMAGE_TAG}" | |
- name: Login to DockerHub | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GitHub Container Registry | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/[email protected] | |
with: | |
platforms: ${{ env.PLATFORMS }} | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Build and push ${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ env.image_tag }} | |
uses: docker/[email protected] | |
with: | |
platforms: ${{ env.PLATFORMS }} | |
push: true | |
tags: | | |
alfonder/${{ env.IMAGE_NAME }}:${{ env.image_tag }} | |
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ env.image_tag }} | |
- name: Build and push ${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest | |
if: ${{ env.is_tag == 'true' }} | |
uses: docker/[email protected] | |
with: | |
platforms: ${{ env.PLATFORMS }} | |
push: true | |
tags: | | |
alfonder/${{ env.IMAGE_NAME }}:latest | |
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest | |
# - name: Update repo description | |
# if: ${{ env.is_tag == 'true' }} | |
# uses: peter-evans/dockerhub-description@v3 | |
# with: | |
# username: ${{ secrets.DOCKERHUB_USERNAME }} | |
# password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
# repository: ${{ github.repository_owner }}/${{ env.IMAGE_NAME }} | |
# short-description: ${{ github.event.repository.description }} | |
- name: Skip Telegram notification | |
shell: bash | |
env: | |
telegram_to: ${{ secrets.TELEGRAM_TO }} | |
if: ${{ env.telegram_to == '' }} | |
run: | | |
echo "Telegram SECRETS not defined, skip Telegram notification" | |
- name: Notify on Telegram | |
uses: appleboy/[email protected] | |
env: | |
telegram_to: ${{ secrets.TELEGRAM_TO }} | |
if: ${{ env.telegram_to != '' }} | |
with: | |
to: ${{ secrets.TELEGRAM_TO }} | |
token: ${{ secrets.TELEGRAM_TOKEN }} | |
message: | | |
New Docker image is built and pushed: | |
alfonder/${{ env.IMAGE_NAME }}:${{ env.image_tag }} | |
https://hub.docker.com/r/alfonder/${{ env.IMAGE_NAME }} | |
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ env.image_tag }} |