Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.
name: Create and publish a Docker image
on:
workflow_dispatch:
inputs:
no-cache:
type: boolean
required: true
default: false
description: 'Whether not to use cache for building the image'
push:
branches:
- 'feature/automatic_builds'
tags:
- 'V*'
env:
REGISTRY: ghcr.io
REPOSITORY: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- 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: Git describe
# id: ghd
# uses: proudust/gh-describe@v1
# - name: Export Docker tag
# env:
# INPUT_TAG: ${{ inputs.image-tag }}
# DESCRIBE_TAG: ${{ steps.ghd.outputs.describe }}
# run: |
# IMAGE_TAG=${INPUT_TAG:-$(echo $DESCRIBE_TAG | sed 's/V//')}
# echo $IMAGE_TAG
# echo IMAGE_TAG=$IMAGE_TAG >> $GITHUB_ENV
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/pinecone-io/canopy
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
no-cache: ${{ inputs.no_cache }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
provenance: false
# tags: ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:${{ env.IMAGE_TAG }},${{ env.REGISTRY }}/${{ env.REPOSITORY }}:main
cache-from: type=gha
cache-to: type=gha,mode=max