Skip to content

fix newline

fix newline #10

Workflow file for this run

name: docker
on:
push:
branches:
- master
env:
REGISTRY: ghcr.io
jobs:
release:
strategy:
matrix:
image:
- name: golang
version: "1.23.0"
- name: node
version: "20.17.0"
- name: postgres
version: "16.4"
tags:
- "16.4"
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker Metadata Action Tags Arguments
id: docker_meta_tags
run: |
tags=""
if [[ $(echo '${{ toJson(matrix.image.tags) }}' | jq -c 'type') == '"array"' ]]; then
for element in ${{ join(matrix.image.tags, ' ') }}; do
tags="${tags}type=raw,${element}\n"
done
else
tags='
type=semver,pattern={{version}},value=${{ matrix.image.version }}
type=semver,pattern={{major}}.{{minor}},value=${{ matrix.image.version }}
'
fi
echo "docker_meta_tags<<EOF" >> $GITHUB_ENV
echo -e "$tags" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- id: docker_meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/re/${{ matrix.image.name }}
tags: ${{ env.docker_meta_tags }}
- id: docker_build
name: Build and push Docker image
uses: docker/build-push-action@v6
with:
platforms: linux/amd64
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
build-args: IMAGE=${{ matrix.image.name }}:${{ matrix.image.version }}
- name: Install Cosign
uses: sigstore/cosign-installer@main
- name: Sign image with a key
run: |
cosign sign --key env://COSIGN_PRIVATE_KEY ${IMAGE_NAME,,}@${IMAGE_DIGEST} --yes
env:
IMAGE_NAME: ${{ env.REGISTRY }}/${{ github.repository_owner }}/re/${{ matrix.image.name }}
IMAGE_DIGEST: ${{ steps.docker_build.outputs.digest }}
COSIGN_PRIVATE_KEY: ${{secrets.COSIGN_PRIVATE_KEY}}
COSIGN_PASSWORD: ${{secrets.COSIGN_PASSWORD}}