refactor(workers): setup now properly updates config cache and restar… #796
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 | |
on: [push, pull_request] | |
jobs: | |
build: | |
if: "!contains(github.event.head_commit.message, 'skip ci')" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Docker Meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ghcr.io/petio-team/petio | |
tags: | | |
type=ref,event=pr | |
type=ref,event=tag | |
type=sha,format=long | |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }} | |
type=raw,value=nightly,enable=${{ github.ref == format('refs/heads/{0}', 'dev') }} | |
type=raw,value=new-ui,enable=${{ github.ref == format('refs/heads/{0}', 'new-ui') }} | |
type=raw,value=preview,enable=${{ github.ref == format('refs/heads/{0}', 'preview') }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
if: ${{ github.event_name != 'pull_request' && github.actor != 'dependabot[bot]' }} | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GHCR_TOKEN }} | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: ${{ runner.os }}-buildx | |
- name: Build and Push | |
id: docker_build | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
platforms: linux/amd64 | |
file: ./Dockerfile | |
push: ${{ github.event_name != 'pull_request' && github.actor != 'dependabot[bot]' }} | |
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 | |
# 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 | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} |