Skip to content

Commit

Permalink
refactor: extract inputs
Browse files Browse the repository at this point in the history
Signed-off-by: Yukai Huang <[email protected]>
  • Loading branch information
Yukaii committed Oct 29, 2024
1 parent c4f04e4 commit 3921a0c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
19 changes: 14 additions & 5 deletions .github/actions/build-steps/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,22 @@ on:
platform:
required: true
type: string
registry_image:
required: true
type: string
runtime:
required: true
type: string
buildpack:
required: true
type: string

jobs:
build:
runs-on: ${{ inputs.platform == 'linux/arm64' && 'macos-latest' || 'ubuntu-latest' }}
steps:
-
name: Prepare
name: Prepare Platform Environment
run: |
echo "PLATFORM_PAIR=${{ inputs.platform//\//- }}" >> $GITHUB_ENV
-
Expand All @@ -23,7 +32,7 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_IMAGE }}
images: ${{ inputs.registry_image }}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand All @@ -45,10 +54,10 @@ jobs:
file: ./deployments/Dockerfile
platforms: ${{ inputs.platform }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
outputs: type=image,name=${{ inputs.registry_image }},push-by-digest=true,name-canonical=true,push=true
build-args: |
RUNTIME=${{ github.event.inputs.runtime || 'hackmdio/runtime:16.20.2-35fe7e39' }}
BUILDPACK=${{ github.event.inputs.buildpack || 'hackmdio/buildpack:16.20.2-35fe7e39' }}
RUNTIME=${{ inputs.runtime }}
BUILDPACK=${{ inputs.buildpack }}
-
name: Export digest
run: |
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/push-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ jobs:
uses: ./.github/actions/build-steps
with:
platform: linux/amd64
registry_image: ${{ env.REGISTRY_IMAGE }}
runtime: ${{ github.event.inputs.runtime }}
buildpack: ${{ github.event.inputs.buildpack }}

build-arm64:
runs-on: macos-latest
Expand All @@ -43,6 +46,9 @@ jobs:
uses: ./.github/actions/build-steps
with:
platform: linux/arm64
registry_image: ${{ env.REGISTRY_IMAGE }}
runtime: ${{ github.event.inputs.runtime }}
buildpack: ${{ github.event.inputs.buildpack }}

merge:
runs-on: ubuntu-latest
Expand Down

0 comments on commit 3921a0c

Please sign in to comment.