Skip to content

Commit

Permalink
chore: move extract step to top
Browse files Browse the repository at this point in the history
  • Loading branch information
njfamirm committed Nov 8, 2023
1 parent cdf719c commit d7718bf
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/publish-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ jobs:
container_folder:
./${{ matrix.path }}/*
- name: πŸ— Extract version from dockerfile
if: ${{ steps.file_change.outputs.container_folder == 'true' }}
id: version
run: |
version_full=$(grep 'ir.alwatr.image.version.full' ./${{ matrix.path }}/Dockerfile | cut -d'"' -f2)
version_short=$(grep 'ir.alwatr.image.version.short' ./${{ matrix.path }}/Dockerfile | cut -d'"' -f2)
echo "version_full=$version_full" >> $GITHUB_OUTPUT
echo "version_short=$version_short" >> $GITHUB_OUTPUT
- name: πŸ— Install cosign
if: ${{ github.event_name != 'pull_request' && steps.file_change.outputs.container_folder == 'true' }}
uses: sigstore/[email protected]
Expand All @@ -105,15 +114,6 @@ 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: |
version_full=$(grep 'ir.alwatr.image.version.full' ./${{ matrix.path }}/Dockerfile | cut -d'"' -f2)
version_short=$(grep 'ir.alwatr.image.version.short' ./${{ matrix.path }}/Dockerfile | cut -d'"' -f2)
echo "version_full=$version_full" >> $GITHUB_OUTPUT
echo "version_short=$version_short" >> $GITHUB_OUTPUT
- name: πŸš€ Build and push container image
if: ${{ steps.file_change.outputs.container_folder == 'true' }}
id: build_and_push
Expand All @@ -122,8 +122,8 @@ jobs:
context: ./${{matrix.path}}
push: ${{github.event_name != 'pull_request'}}
tags: |
${{env.REGISTRY}}/${{env.USER}}/${{matrix.name}}:${{steps.meta.outputs.version_full}}
${{env.REGISTRY}}/${{env.USER}}/${{matrix.name}}:${{steps.meta.outputs.version_short}}
${{env.REGISTRY}}/${{env.USER}}/${{matrix.name}}:${{steps.version.outputs.version_full}}
${{env.REGISTRY}}/${{env.USER}}/${{matrix.name}}:${{steps.version.outputs.version_short}}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
build-args: |
Expand All @@ -135,5 +135,5 @@ jobs:
env:
COSIGN_EXPERIMENTAL: 'true'
run: |
cosign sign --yes "${{env.REGISTRY}}/${{env.USER}}/${{matrix.name}}:${{steps.meta.outputs.version_full}}@${{steps.build_and_push.outputs.digest}}"
cosign sign --yes "${{env.REGISTRY}}/${{env.USER}}/${{matrix.name}}:${{steps.meta.outputs.version_short}}@${{steps.build_and_push.outputs.digest}}"
cosign sign --yes "${{env.REGISTRY}}/${{env.USER}}/${{matrix.name}}:${{steps.version.outputs.version_full}}@${{steps.build_and_push.outputs.digest}}"
cosign sign --yes "${{env.REGISTRY}}/${{env.USER}}/${{matrix.name}}:${{steps.version.outputs.version_short}}@${{steps.build_and_push.outputs.digest}}"

0 comments on commit d7718bf

Please sign in to comment.