Skip to content

Commit

Permalink
tag ghcr in build step (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominion5254 authored Jan 16, 2025
1 parent 3e0152d commit ab1d276
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/ghcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ on:
push:
tags:
- v*
pull_request: []
workflow_dispatch:

jobs:
push-image:
Expand All @@ -20,15 +18,14 @@ jobs:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Set IMAGE_ID
run: echo "IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME" | tr '[A-Z]' '[a-z]' >> $GITHUB_ENV
- name: Build image
run: docker buildx build . --platform linux/amd64,linux/arm64 --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" --push
run: docker buildx build . --platform linux/amd64,linux/arm64 --tag $IMAGE_ID --label "runnumber=${GITHUB_RUN_ID}" --push
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Push image
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
[ "$VERSION" == "master" ] && VERSION=latest
Expand Down

0 comments on commit ab1d276

Please sign in to comment.