change separator to slash #3
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: Build container image | |
on: | |
push: | |
tags: | |
- "[a-z-]+/[a-z0-9-]+" | |
env: | |
REGISTRY: ghcr.io | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: extract image name and tag using bash parameter expansion | |
run: | | |
image_name=${GITHUB_REF_NAME#*/} | |
image_tag=${GITHUB_REF_NAME%%/*} | |
echo "image_name=$image_name" >> "$GITHUB_ENV" | |
echo "image_tag=$image_tag" >> "$GITHUB_ENV" | |
- uses: actions/checkout@v3 | |
- uses: docker/setup-qemu-action@v2 | |
- uses: docker/setup-buildx-action@v2 | |
- uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker metadata | |
id: metadata | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ format('ghcr.io/astriaorg/test-images-{0}', env.image_name) }} | |
tags: | | |
type=raw,value=${{env.image_tag}} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
# this gets rid of the unknown/unknown image that is created without this setting | |
# https://github.com/docker/build-push-action/issues/820#issuecomment-1455687416 | |
provenance: false | |
context: . | |
file: ${{ format('Dockerfile.{0}', env.image_name) }} | |
platforms: 'linux/amd64,linux/arm64' | |
push: true | |
tags: ${{ steps.metadata.outputs.tags }} | |
labels: ${{ steps.metadata.outputs.labels }} |