0.3.3 #1
Workflow file for this run
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: Release Image | |
on: | |
workflow_dispatch: | |
release: | |
types: [created] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
DOCKERHUB_REPO: ${{ vars.DOCKERHUB_USER }}/smol-kv | |
jobs: | |
build: | |
strategy: | |
matrix: | |
arch: [amd64, arm64] | |
runs-on: ${{ matrix.arch }} | |
environment: release | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set DOCKER_CONFIG | |
run: | | |
mkdir -p ${{ github.workspace }}/.docker | |
echo "DOCKER_CONFIG=${{ github.workspace }}/.docker" >> $GITHUB_ENV | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
env: | |
DOCKER_CONFIG: ${{ env.DOCKER_CONFIG }} | |
with: | |
logout: false | |
username: ${{ vars.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- run: | | |
docker context create desktop-linux || true | |
docker context use desktop-linux | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
driver-opts: image=moby/buildkit:master | |
version: v0.15.1 | |
endpoint: desktop-linux | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
provenance: false | |
platforms: linux/${{ matrix.arch }} | |
tags: ${{ env.DOCKERHUB_REPO}}:latest-${{ matrix.arch }} | |
cache-from: type=gha,scope=smolkv-${{ github.ref}}-${{ matrix.arch }} | |
cache-to: type=gha,scope=smolkv-${{ github.ref}}-${{ matrix.arch }},mode=max | |
finalize: | |
needs: build | |
runs-on: amd64 | |
environment: release | |
steps: | |
- name: Set DOCKER_CONFIG | |
run: | | |
mkdir -p ${{ github.workspace }}/.docker | |
echo "DOCKER_CONFIG=${{ github.workspace }}/.docker" >> $GITHUB_ENV | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
env: | |
DOCKER_CONFIG: ${{ env.DOCKER_CONFIG }} | |
with: | |
logout: false | |
username: ${{ vars.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Merge image tags | |
uses: Noelware/docker-manifest-action@master | |
with: | |
inputs: ${{ env.DOCKERHUB_REPO }}:latest,${{ env.DOCKERHUB_REPO }}:${{ github.sha }} | |
images: ${{ env.DOCKERHUB_REPO }}:latest-amd64,${{ env.DOCKERHUB_REPO }}:latest-arm64 | |
push: true |