Skip to content

Commit

Permalink
ci(image): refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Mogyuchi committed Aug 20, 2024
1 parent 7d82a2d commit 736457b
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,28 +141,25 @@ jobs:
type=edge
type=ref,event=branch
- name: Build Image (linux/amd64)
run: |
newcontainer=$(buildah from --platform=linux/amd64 scratch)
buildah copy --chmod=0755 $newcontainer ./artifact/x86_64-unknown-linux-musl/${{ needs.env.outputs.BINARY_NAME }} /${{ needs.env.outputs.BINARY_NAME }}
buildah config --entrypoint='["./${{ needs.env.outputs.BINARY_NAME }}"]' $newcontainer
- run: |
build() {
newcontainer=$(buildah from --platform="$1" scratch)
buildah copy --chmod=0755 $newcontainer ./artifact/"$2"/${{ needs.env.outputs.BINARY_NAME }} /${{ needs.env.outputs.BINARY_NAME }}
buildah config --entrypoint='["./${{ needs.env.outputs.BINARY_NAME }}"]' $newcontainer
buildah config --author="Mogyuchi" $(awk '{print "--label=" $0}' <<< "${{ steps.meta.outputs.labels }}") $newcontainer
buildah inspect $newcontainer
buildah config --author="Mogyuchi" $(awk '{print "--label=" $0}' <<< "${{ steps.meta.outputs.labels }}") $newcontainer
buildah inspect $newcontainer
buildah commit --manifest=localhost/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }} $newcontainer
buildah rm $newcontainer
buildah commit --manifest=localhost/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }} $newcontainer
buildah rm $newcontainer
}
export -f build
- name: Build Image (linux/amd64)
run: |
build linux/amd64 x86_64-unknown-linux-musl
- name: Build Image (linux/arm64)
run: |
newcontainer=$(buildah from --platform=linux/arm64 scratch)
buildah copy --chmod=0755 $newcontainer ./artifact/aarch64-unknown-linux-musl/${{ needs.env.outputs.BINARY_NAME }} /${{ needs.env.outputs.BINARY_NAME }}
buildah config --entrypoint='["./${{ needs.env.outputs.BINARY_NAME }}"]' $newcontainer
buildah config --author="Mogyuchi" $(awk '{print "--label=" $0}' <<< "${{ steps.meta.outputs.labels }}") $newcontainer
buildah inspect $newcontainer
buildah commit --manifest=localhost/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }} $newcontainer
buildah rm $newcontainer
build linux/arm64 aarch64-unknown-linux-musl
- id: push
name: Push To GHCR
Expand Down

0 comments on commit 736457b

Please sign in to comment.