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

Commit 9a97e49

Browse files
1azizAziz
andauthored
Add support for Github Packages (#147)
* add login step for GHCR * update image name * update image name to lowercase * update image name in Makefile Co-authored-by: Aziz <aziz@cs>
1 parent 89d57f4 commit 9a97e49

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

.github/workflows/main.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ jobs:
5656
- name: Prepare
5757
id: prep
5858
run: |
59-
DOCKER_IMAGE=containersol/externalsecret-operator
59+
IMAGE_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')
60+
DOCKER_IMAGE=ghcr.io/${IMAGE_REPOSITORY}
6061
6162
VERSION=edge
6263
if [[ $GITHUB_REF == refs/tags/* ]]; then
@@ -76,7 +77,7 @@ jobs:
7677
REPO_FULL_NAME="${{ github.event.pull_request.head.repo.full_name }}"
7778
# If this is both a pull request and a fork, then don't push the image
7879
if [[ ${{ github.event_name }} == pull_request ]]; then
79-
if [[ $REPO_FULL_NAME != ContainerSolutions/externalsecret-operator ]]; then
80+
if [[ $REPO_FULL_NAME != ${{ github.repository }} ]]; then
8081
PUSH_IMAGE=false
8182
fi
8283
fi
@@ -98,13 +99,14 @@ jobs:
9899
- name: Set up Docker Buildx
99100
id: buildx
100101
uses: docker/setup-buildx-action@v1
101-
102-
- name: Login to DockerHub
102+
103+
- name: Login to Github Packages
103104
id: docker-login
104105
uses: docker/login-action@v1
105106
with:
106-
username: ${{ secrets.DOCKER_USERNAME }}
107-
password: ${{ secrets.DOCKER_TOKEN }}
107+
registry: ghcr.io
108+
username: ${{ secrets.GHCR_USERNAME }}
109+
password: ${{ secrets.GHCR_TOKEN }}
108110
if: ${{ steps.prep.outputs.push_image == 'true' }}
109111

110112
- name: Build and push

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ endif
1212
BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
1313

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

0 commit comments

Comments
 (0)