0
0
mirror of https://github.com/tursodatabase/libsql.git synced 2024-09-22 09:40:53 +00:00
libsql/.github/workflows/storage-server-images.yml
2024-07-01 18:20:46 +00:00

65 lines
1.7 KiB
YAML

name: Storage server Docker image
on:
workflow_dispatch:
push:
branches: [ "main" ]
paths:
- "libsql-storage-server/**"
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}-storage-server-devel
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Get short SHA
id: get-short-sha
run: |
SHA="$(echo ${GITHUB_SHA::7})"
echo "sha=$SHA" >> "$GITHUB_OUTPUT"
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
${{ steps.meta.outputs.tags }}-${{ steps.get-short-sha.outputs.sha }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
file: "./libsql-storage-server/Dockerfile"
- name: Echo image name
run: |
echo "Pushed: ${{ steps.meta.outputs.tags }}-${{ steps.get-short-sha.outputs.sha }}"