Skip to content
This repository has been archived by the owner on Jul 5, 2021. It is now read-only.

Commit

Permalink
Add support for Github Packages (#147)
Browse files Browse the repository at this point in the history
* add login step for GHCR

* update image name

* update image name to lowercase

* update image name in Makefile

Co-authored-by: Aziz <aziz@cs>
  • Loading branch information
1aziz and Aziz committed Jan 22, 2021
1 parent 89d57f4 commit 9a97e49
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ jobs:
- name: Prepare
id: prep
run: |
DOCKER_IMAGE=containersol/externalsecret-operator
IMAGE_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')
DOCKER_IMAGE=ghcr.io/${IMAGE_REPOSITORY}
VERSION=edge
if [[ $GITHUB_REF == refs/tags/* ]]; then
Expand All @@ -76,7 +77,7 @@ jobs:
REPO_FULL_NAME="${{ github.event.pull_request.head.repo.full_name }}"
# If this is both a pull request and a fork, then don't push the image
if [[ ${{ github.event_name }} == pull_request ]]; then
if [[ $REPO_FULL_NAME != ContainerSolutions/externalsecret-operator ]]; then
if [[ $REPO_FULL_NAME != ${{ github.repository }} ]]; then
PUSH_IMAGE=false
fi
fi
Expand All @@ -98,13 +99,14 @@ jobs:
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub

- name: Login to Github Packages
id: docker-login
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
if: ${{ steps.prep.outputs.push_image == 'true' }}

- name: Build and push
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ endif
BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)

# Image URL to use all building/pushing image targets
IMG ?= containersol/externalsecret-operator
IMG ?= ghcr.io/containersolutions/externalsecret-operator
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:trivialVersions=true"

Expand Down

0 comments on commit 9a97e49

Please sign in to comment.