Skip to content

Commit

Permalink
try docker meta tags
Browse files Browse the repository at this point in the history
  • Loading branch information
rucciva committed Aug 29, 2024
1 parent 84e28ca commit 2cab781
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
version: "20.17.0"
- name: postgres
version: "16.4"
tags:
- "16.4"
runs-on: ubuntu-latest

steps:
Expand All @@ -35,13 +37,31 @@ jobs:
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}$(echo "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 "$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: |
type=semver,pattern={{version}},value=${{ matrix.image.version }}
type=semver,pattern={{major}}.{{minor}},value=${{ matrix.image.version }}
tags: ${{ env.docker_meta_tags }}

- id: docker_build
name: Build and push Docker image
Expand Down

0 comments on commit 2cab781

Please sign in to comment.