Skip to content

Commit

Permalink
Update github action to use docker action as well as build for arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
roceb committed Aug 12, 2024
1 parent cfbfe0c commit d7c5c80
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,23 @@ jobs:
packages: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3

- name: Build swarm image
run: |
docker build . \
--build-arg JSWARM_UID=48435 \
--build-arg JSWARM_GID=202 \
--tag $CONTAINER_NAME \
--label "runnumber=${GITHUB_RUN_ID}"
- name: Log in to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Push images
run: |
CONTAINER_ID=ghcr.io/${{ github.repository_owner }}/$CONTAINER_NAME
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
[ "$VERSION" == "master" ] && VERSION=latest
echo CONTAINER_ID=$CONTAINER_ID
echo VERSION=$VERSION
docker tag $CONTAINER_NAME $CONTAINER_ID:$VERSION
docker push $CONTAINER_ID:$VERSION
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/${{ github.repository }}:${{ [github.ref_name = "master"] && echo "latest" ||echo "merge" }}
build-args: JSWARM_UID=48435,JSWARM_GID=202
labels: runnumber=${{ GITHUB_RUN_ID }}

0 comments on commit d7c5c80

Please sign in to comment.