Skip to content

Commit

Permalink
TMP: push artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinMind committed Jun 26, 2024
1 parent b0bf784 commit 0767445
Showing 1 changed file with 39 additions and 14 deletions.
53 changes: 39 additions & 14 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,6 @@ runs:
version: latest
buildkitd-flags: --debug

# Login to a registry to push the image
- name: Login to Container Registry
# Only login if we are pushing the image
if: ${{ inputs.push == 'true' }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ inputs.username }}
password: ${{ inputs.password }}

- name: Docker Image
id: image
shell: bash
Expand Down Expand Up @@ -100,15 +90,50 @@ runs:
cat $GITHUB_OUTPUT
- name: Tar file
id: tar
shell: bash
run: |
echo "path=/tmp/image.tar" >> $GITHUB_OUTPUT
- name: Build Image
id: build
uses: docker/bake-action@v4
env:
DOCKER_TAG: ${{ steps.tag.outputs.tag }}
with:
targets: app
push: ${{ inputs.push }}
load: ${{ inputs.push == 'false' }}
set: |
*.cache-from=type=registry,ref=${{ steps.tag.outputs.tag_cache }}
*.cache-to=type=registry,ref=${{ steps.tag.outputs.tag_cache }},mode=max,compression-level=9,force-compression=true,ignore-error=true
*.output=type=docker,dest=${{ steps.tar.outputs.path }}
- name: Get image digest
id: digest
shell: bash
run: |
echo '${{ steps.build.outputs.metadata }}' > metadata.json
echo "digest=$(cat metadata.json | jq -r '.web."containerimage.digest"')" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.digest.outputs.digest }}
path: ${{ steps.tar.outputs.path }}
retention-days: 1
compression: 9
overwrite: true

- name: Login to Container Registry
if: inputs.push == 'true'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ inputs.username }}
password: ${{ inputs.password }}

- name: Push Image
if: inputs.push == 'true'
shell: bash
run: |
docker load < ${{ steps.tar.outputs.path }}
docker image push --all-tags ${{ steps.image.outputs.image }}

0 comments on commit 0767445

Please sign in to comment.