Skip to content

Commit

Permalink
Merge pull request #5 from infralovers/ghcr-template
Browse files Browse the repository at this point in the history
  • Loading branch information
ehaselwanter authored Mar 15, 2023
2 parents 60ee77e + 43f6d7f commit 15c9890
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions workflow-templates/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,26 +51,31 @@ jobs:
if [[ -n "${{ secrets.IMAGE_REPO }}" ]]; then
IMAGE_REPO="${{ secrets.IMAGE_REPO }}"
fi
HUB_IMAGE="docker.io/$IMAGE_REPO/$IMAGE_NAME"
QUAY_IMAGE="quay.io/$IMAGE_REPO/$IMAGE_NAME"
GHCR_IMAGE="ghcr.io/${{ github.repository }}"
VERSION="dev"
if [[ '${{ needs.prebuild.outputs.version }}' != '' ]]; then
VERSION="${{ needs.prebuild.outputs.version }}"
fi
if [ "${{ github.event_name }}" = "schedule" ]; then
VERSION="nightly"
fi
TAGS="${QUAY_IMAGE}:${VERSION},${HUB_IMAGE}:${VERSION}"
TAGS="${QUAY_IMAGE}:${VERSION},${GHCR_IMAGE}:${VERSION}"
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
TAGS="$TAGS,${QUAY_IMAGE}:latest,${HUB_IMAGE}:latest"
TAGS="$TAGS,${QUAY_IMAGE}:latest,${GHCR_IMAGE}:latest"
fi
echo "settings tag ${TAGS}"
echo ::set-output name=tags::${TAGS}
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: 'arm64,amd64'

- name: Cache Docker layers
uses: actions/cache@v2
with:
Expand All @@ -94,6 +99,14 @@ jobs:
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_TOKEN }}

- name: Login to GitHub Container Registry
if: needs.prebuild.outputs.version != ''
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.BOT_ACCESS_TOKEN }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
Expand Down

0 comments on commit 15c9890

Please sign in to comment.