Skip to content

Set cache folder

Set cache folder #2

Workflow file for this run

name: Server
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: Prepare - Checkout
uses: actions/checkout@v4.0.0
- name: Prepare - Inject short Variables
uses: rlespinasse/github-slug-action@v4.4.1
- name: Prepare - Set up Docker Buildx
uses: docker/setup-buildx-action@v2.10.0
- name: Build - BUILD
uses: docker/build-push-action@v4.2.1
with:
load: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
tags: on-local
- name: Publish - Calculate Version
if: github.event_name != 'pull_request'
env:
BUILD_NUMBER: ${{ github.run_number }}
run: |
echo "BUILD_NUMBER=$(($BUILD_NUMBER))" >> $GITHUB_ENV
- name: Publish - Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Publish - Rename Tags
if: github.event_name != 'pull_request'
run: |
docker tag on-local ghcr.io/code-slide/server:dev
docker tag on-local ghcr.io/code-slide/server:dev-${{ env.BUILD_NUMBER }}
- name: Publish - Push Tags
if: github.event_name != 'pull_request'
run: |
docker push ghcr.io/code-slide/server:dev
docker push ghcr.io/code-slide/server:dev-${{ env.BUILD_NUMBER }}