diff --git a/.github/workflows/publish-container.yml b/.github/workflows/publish-container.yml index 50b3b2e..cd833d8 100644 --- a/.github/workflows/publish-container.yml +++ b/.github/workflows/publish-container.yml @@ -28,69 +28,36 @@ jobs: include: - name: traefik path: traefik - version: - short: 1 - full: 1.7.34-alpine - name: alpine path: alpine - version: - short: 3 - full: 3.17 - name: php path: php/7.4-apache - version: - short: 7-apache - full: 7.4-apache - name: php path: php/7.4-fpm - version: - short: 7 - full: 7.4 - name: php path: php/8.2-fpm - version: - short: 8 - full: 8.2 - name: adminer path: adminer - version: - short: 4 - full: 4.8-3.24.4 - name: mariadb path: mariadb - version: - short: 10 - full: 10.9-3.26.4 - name: nocodb path: nocodb - version: - short: 0.202 - full: 0.202.5 - name: wordpress path: wordpress/php7.4 - version: - short: 6-php7 - full: 6.1-php7.4-fpm - name: wordpress path: wordpress/php8.2 - version: - short: 6 - full: 6.3-php8.2-fpm - name: tdlib path: tdlib - version: - short: 1 - full: 1.8.0 permissions: contents: read @@ -132,6 +99,15 @@ jobs: username: ${{github.repository_owner}} password: ${{secrets.GITHUB_TOKEN}} + - name: 🏗 Extract version from dockerfile + if: ${{ steps.file_change.outputs.container_folder == 'true' }} + id: meta + run: | + ref_name=$(grep 'org.opencontainers.image.ref.name' ./${{ matrix.path }}/Dockerfile | cut -d'"' -f2) + version=$(grep 'org.opencontainers.image.version' ./${{ matrix.path }}/Dockerfile | cut -d'"' -f2) + echo ::set-output name=ref_name::${ref_name} + echo ::set-output name=version::${version} + - name: 🚀 Build and push container image if: ${{ steps.file_change.outputs.container_folder == 'true' }} id: build_and_push @@ -140,8 +116,8 @@ jobs: context: ./${{matrix.path}} push: ${{github.event_name != 'pull_request'}} tags: | - ${{env.REGISTRY}}/${{env.USER}}/${{matrix.name}}:${{matrix.version.short}} - ${{env.REGISTRY}}/${{env.USER}}/${{matrix.name}}:${{matrix.version.full}} + ${{env.REGISTRY}}/${{env.USER}}/${{matrix.name}}:${{steps.meta.outputs.ref_name}} + ${{env.REGISTRY}}/${{env.USER}}/${{matrix.name}}:${{steps.meta.outputs.version}} cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache build-args: | @@ -153,5 +129,5 @@ jobs: env: COSIGN_EXPERIMENTAL: 'true' run: | - cosign sign --yes "${{env.REGISTRY}}/${{env.USER}}/${{matrix.name}}:${{matrix.version.short}}@${{steps.build_and_push.outputs.digest}}" - cosign sign --yes "${{env.REGISTRY}}/${{env.USER}}/${{matrix.name}}:${{matrix.version.full}}@${{steps.build_and_push.outputs.digest}}" + cosign sign --yes "${{env.REGISTRY}}/${{env.USER}}/${{matrix.name}}:${{steps.meta.outputs.ref_name}}@${{steps.build_and_push.outputs.digest}}" + cosign sign --yes "${{env.REGISTRY}}/${{env.USER}}/${{matrix.name}}:${{steps.meta.outputs.version}}@${{steps.build_and_push.outputs.digest}}"