This commit is contained in:
kokomo123
2024-08-24 22:45:51 +00:00
committed by GitHub

View File

@@ -51,24 +51,49 @@ jobs:
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && IMAGE_VERSION=$(echo $IMAGE_VERSION | sed -e 's/^v//')
echo "IMAGE_VERSION=$IMAGE_VERSION" >> $GITHUB_ENV
echo "IMAGE_ID=$(echo ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME | tr '[A-Z]' '[a-z]')" >> $GITHUB_ENV
# region See: https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-ghcrio
- name: Build Image
run: |
docker build -t $IMAGE_NAME .
# region See: https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-ghcrio
- name: Use QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all
- name: Testing metadata extraction
id: meta
uses: docker/metadata-action@master
with:
images: kokomo123/5etools-img
tags: |
add-arm64-building
type=edge
type=sha
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Log In to Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push Image
- name: Build the docker image
uses: docker/build-push-action@master
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/arm64,linux/amd64
push: false
- name: Push image
run: |
echo IMAGE_ID=$IMAGE_ID
echo IMAGE_VERSION=$IMAGE_VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$IMAGE_VERSION
# Always tag latest when pushing a tag, as we don't expect to ever merge old tags
[[ "${{ github.ref }}" == "refs/tags/"* ]] && docker tag $IMAGE_NAME $IMAGE_ID:latest
docker tag $IMAGE_ID $IMAGE_ID:$IMAGE_VERSION
[[ "${{ github.ref }}" == "refs/tags/"* ]] && docker tag $IMAGE_NAME $IMAGE_ID:add-arm64-building
docker push $IMAGE_ID:$IMAGE_VERSION
docker push $IMAGE_ID:latest
docker push $IMAGE_ID:add-arm64-building
# endregion