Skip to content

Feature/turbo simple #151

Feature/turbo simple

Feature/turbo simple #151

name: Docker – sync-procedures
on:
workflow_dispatch:
push:
paths:
- 'services/cron-jobs/sync-procedures/**'
branches:
- 'master'
tags:
- 'sync-procedures@v*'
pull_request:
paths:
- 'services/cron-jobs/sync-procedures/**'
branches:
- 'master'
jobs:
push:
runs-on: ubuntu-latest
environment: docker
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: democracy/sync-procedures
tags: |
type=ref,event=branch,enable=${{ github.ref == format('refs/heads/{0}', 'master') || github.ref == format('refs/heads/{0}', 'alpha') || github.ref == format('refs/heads/{0}', 'internal') }}
type=ref,event=pr
type=match,asref=foo,pattern=sync-procedures@v(\d+.\d+.\d+)(-alpha.\d+)?,group=1
type=semver,pattern={{version}},use=foo
type=sha,enable=${{ github.event_name == 'workflow_dispatch' }}
- name: Print Meta Summary
run: |
echo "🏷️ Tags: ${{ steps.meta.outputs.tags }}
" >> $GITHUB_STEP_SUMMARY
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@master
with:
install: true
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-multi-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-multi-buildx
- name: Login to DockerHub
uses: docker/login-action@v1
if: github.event_name != 'pull_request'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v4
with:
context: services/cron-jobs/sync-procedures
file: infra/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
- name: Move buildx cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}