Skip to content

Commit

Permalink
chore: use more actions for image building
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Jan 23, 2022
1 parent faae4b6 commit 9f2b510
Showing 1 changed file with 24 additions and 13 deletions.
37 changes: 24 additions & 13 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,15 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
- name: Build & Push image
- name: Login to registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Determine images to publish
id: image-tags
run: |
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME
Expand All @@ -40,13 +46,18 @@ jobs:
# Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker buildx build \
--push \
--tag $IMAGE_ID:$VERSION \
--platform linux/arm/v7 \
--platform linux/arm64 \
--platform linux/amd64 \
.
IMAGES=
IMAGES="$IMAGE_ID:$VERSION"$'\n'$IMAGES
# debug output
echo images $IMAGES
echo ::set-output name=images::"$IMAGES"
- name: Build and push
uses: docker/build-push-action@v2
if: ${{ steps.image-tags.outputs.images }}
with:
context: .
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
tags: ${{ steps.image-tags.outputs.images }}

0 comments on commit 9f2b510

Please sign in to comment.