Skip to content

Merge pull request #105 from nerdcubed/dependabot/pip/aiohttp-3.8.6 #326

Merge pull request #105 from nerdcubed/dependabot/pip/aiohttp-3.8.6

Merge pull request #105 from nerdcubed/dependabot/pip/aiohttp-3.8.6 #326

Workflow file for this run

name: Docker Build
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Prepare
id: prepare
run: |
IMAGE_NAME=heleus
GIT_REPO='https://github.com/${{ github.repository }}'
DOCKER_USER=`echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]'`
DOCKER_IMAGE=ghcr.io/$DOCKER_USER/$IMAGE_NAME
DOCKER_IMAGE_HUB=$DOCKER_USER/$IMAGE_NAME
VERSION=`git rev-parse --short HEAD`
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
fi
echo ::set-output name=git_repo::${GIT_REPO}
echo ::set-output name=docker_user::${DOCKER_USER}
echo ::set-output name=docker_image::${DOCKER_IMAGE}
echo ::set-output name=docker_image_hub::${DOCKER_IMAGE_HUB}
echo ::set-output name=version::${VERSION}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Log in to Docker Hub
uses: docker/login-action@v2
if: ${{ (github.ref == 'refs/heads/main') || (contains(github.ref, 'refs/tags/') == true) }}
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_SECRET }}
- name: Login to Docker Registry
uses: docker/login-action@v2
if: ${{ (github.ref == 'refs/heads/main') || (contains(github.ref, 'refs/tags/') == true) }}
with:
registry: ghcr.io
username: ${{ steps.prepare.outputs.docker_user }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push
uses: docker/build-push-action@v2
with:
context: .
push: ${{ (github.ref == 'refs/heads/main') || (contains(github.ref, 'refs/tags/') == true) }}
tags: |
${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}
${{ steps.prepare.outputs.docker_image_hub }}:${{ steps.prepare.outputs.version }}
build-args: GIT_REPO=${{ steps.prepare.outputs.git_repo }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
platforms: linux/amd64,linux/arm64
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
automerge:
needs: build
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
steps:
- uses: fastify/github-action-merge-dependabot@v3
with:
github-token: ${{ secrets.GH_PAT }}