Skip to content

Commit

Permalink
Fix tar saving step in github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
jackkleeman committed Dec 4, 2024
1 parent 8a1bc62 commit b315874
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ on:

workflow_dispatch:
inputs:
uploadImageAsTarball:
description: 'uploads the Docker image additionally as a tarball'
required: false
default: false
type: boolean
platforms:
description: 'platforms for docker build step'
required: false
default: ''
type: string
debug:
description: 'include debug symbols in built image'
required: false
Expand Down Expand Up @@ -117,29 +127,27 @@ jobs:
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build${{inputs.uploadImageAsTarball != true && ' and push ' || ' '}}Docker image
- name: Build${{(inputs.uploadImageAsTarball != true || github.ref == 'refs/heads/main') && ' and push ' || ' '}}Docker image
id: build
uses: docker/build-push-action@v6
with:
context: .
file: "docker/Dockerfile"
push: ${{ inputs.uploadImageAsTarball != true }}
tags: ${{ steps.meta.outputs.tags }}
load: ${{ inputs.uploadImageAsTarball == true }}
# push if we aren't uploading as a tarball, or if this is main
outputs: |
${{ (inputs.uploadImageAsTarball != true || github.ref == 'refs/heads/main') && 'type=registry' || '' }}
${{ inputs.uploadImageAsTarball == true && 'type=tar,dest=restate.tar' || '' }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ inputs.platforms || 'linux/arm64,linux/amd64' }}
# on main, always push both platforms, otherwise use platform input
platforms: ${{ github.ref == 'refs/heads/main' && 'linux/arm64,linux/amd64' || (inputs.platforms || 'linux/arm64,linux/amd64') }}
network: host
build-args: |
CARGO_PROFILE_RELEASE_DEBUG=${{ inputs.debug }}
RESTATE_FEATURES=${{ inputs.features || '' }}
cache-from: type=gha,url=http://127.0.0.1:49160/
cache-to: type=gha,url=http://127.0.0.1:49160/,mode=max

- name: Save docker image as tar
if: ${{ inputs.uploadImageAsTarball }}
run: |
docker save -o restate.tar ${{ steps.build.outputs.imageid }}
- name: Upload docker image tar as artifact
if: ${{ inputs.uploadImageAsTarball }}
uses: actions/upload-artifact@v4
Expand Down

0 comments on commit b315874

Please sign in to comment.