Prepare universal workflow

This commit is contained in:
Alexey Pustovalov 2024-02-08 03:27:02 +09:00
parent ce62b9b66f
commit 6240393eb4

View File

@ -150,32 +150,23 @@ jobs:
echo "list=$platform_list" >> $GITHUB_OUTPUT
- name: Generate tags (release)
id: meta_release
- name: Generate tags
id: meta
if: ${{ needs.init_build.outputs.current_branch != 'trunk' }}
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_REPOSITORY }}/zabbix-${{ env.BASE_BUILD_NAME }}
tags: |
type=semver,pattern={{version}},prefix=${{ matrix.os }}-
type=semver,pattern={{version}},suffix=-${{ matrix.os }}
type=ref,event=branch,prefix=${{ matrix.os }}-,suffix=-latest
type=ref,event=branch,suffix=-${{ matrix.os }}-latest
type=raw,enable=${{ needs.init_build.outputs.is_default_branch == 'true' }},value=${{matrix.os}}-latest
type=semver,enable=${{ needs.init_build.outputs.current_branch != 'trunk' }},pattern={{version}},prefix=${{ matrix.os }}-
type=semver,enable=${{ needs.init_build.outputs.current_branch != 'trunk' }},pattern={{version}},suffix=-${{ matrix.os }}
type=ref,enable=${{ needs.init_build.outputs.current_branch != 'trunk' }},event=branch,prefix=${{ matrix.os }}-,suffix=-latest
type=ref,enable=${{ needs.init_build.outputs.current_branch != 'trunk' }},event=branch,suffix=-${{ matrix.os }}-latest
type=raw,enable=${{ (needs.init_build.outputs.current_branch != 'trunk') && (needs.init_build.outputs.is_default_branch == 'true') }},value=${{matrix.os}}-latest
type=ref,enable=${{ needs.init_build.outputs.current_branch == 'trunk' }},event=branch,prefix=${{ matrix.os }}-
type=ref,enable=${{ needs.init_build.outputs.current_branch == 'trunk' }},event=branch,suffix=-${{ matrix.os }}
flavor: |
latest=${{ (matrix.os == 'alpine') && ( needs.init_build.outputs.is_default_branch == 'true' ) }}
latest=${{ (needs.init_build.outputs.current_branch != 'trunk') && (matrix.os == 'alpine') && ( needs.init_build.outputs.is_default_branch == 'true' ) }}
- name: Generate tags (trunk)
id: meta_trunk
if: ${{ needs.init_build.outputs.current_branch == 'trunk' }}
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_REPOSITORY }}/zabbix-${{ env.BASE_BUILD_NAME }}
tags: |
type=ref,event=branch,prefix=${{ matrix.os }}-
type=ref,event=branch,suffix=-${{ matrix.os }}
flavor: |
latest=false
- name: Build ${{ env.BASE_BUILD_NAME }}/${{ matrix.os }} and push
id: docker_build
@ -187,9 +178,5 @@ jobs:
push: ${{ secrets.AUTO_PUSH_IMAGES }}
tags: ${{ steps.meta_release.conclusion == 'skipped' && steps.meta_trunk.outputs.tags || steps.meta_release.outputs.tags }}
labels: |
org.opencontainers.image.revision=${{ steps.meta_release.conclusion == 'skipped' &&
fromJSON(steps.meta_trunk.outputs.json).labels['org.opencontainers.image.revision'] ||
fromJSON(steps.meta_release.outputs.json).labels['org.opencontainers.image.revision'] }}
org.opencontainers.image.created=${{ steps.meta_release.conclusion == 'skipped' &&
fromJSON(steps.meta_trunk.outputs.json).labels['org.opencontainers.image.created'] ||
fromJSON(steps.meta_release.outputs.json).labels['org.opencontainers.image.created'] }}
org.opencontainers.image.revision=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
org.opencontainers.image.created=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}