Skip to content

Merge pull request #167 from austins/renovate/actions-cache-4.x #414

Merge pull request #167 from austins/renovate/actions-cache-4.x

Merge pull request #167 from austins/renovate/actions-cache-4.x #414

Workflow file for this run

name: Deploy
on:
push:
branches: [ master ]
concurrency:
group: deploy
cancel-in-progress: true
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
analyze:
uses: ./.github/workflows/codeql.yml
test:
needs: analyze
uses: ./.github/workflows/test.yml
docker:
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to Docker registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: ./
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
- # Temp fix for caches are copied over the existing cache so it keeps growing currently.
# 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
deploy:
needs: docker
runs-on: ubuntu-latest
steps:
- name: Trigger deployment webhook
uses: distributhor/workflow-webhook@v3
env:
webhook_url: ${{ secrets.WEBHOOK_URL }}
webhook_secret: ${{ secrets.WEBHOOK_SECRET }}