From c3c628c41ff5508dad30b52869d98d2c45ff5249 Mon Sep 17 00:00:00 2001 From: Duologic Date: Mon, 2 Dec 2024 15:28:12 +0100 Subject: [PATCH] ci: publish to ghcr --- .github/workflows/push.yaml | 18 +++++++++++------- Makefile | 3 ++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 82529d0..54fb194 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -16,11 +16,16 @@ on: default: current env: - UPBOUND_MARKETPLACE_PUSH_ROBOT_USR: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR }} + REGISTRY: ghcr.io jobs: build: runs-on: ubuntu-22.04 + + permissions: + contents: read + packages: write + steps: - name: Checkout uses: actions/checkout@v4 @@ -32,13 +37,12 @@ jobs: version: ${{ github.event.inputs.version }} command: -h - - name: Login to Upbound - uses: docker/login-action@v3 - if: env.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR != '' + - name: Log in to the GitHub Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 with: - registry: xpkg.upbound.io - username: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR }} - password: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_PSW }} + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Push xpkg run: make push diff --git a/Makefile b/Makefile index eb019d7..0e668d0 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ LIBRARY_VERSION:=0.0.5 PROVIDER_VERSION:=0.21.0 JSONNET_BIN:=jrsonnet CROSSPLANE?=crank +REGISTRY?=ghcr.io VENDOR_DEPTHS:=$(shell find generator/vendor -type f) @@ -35,7 +36,7 @@ packages=$(wildcard packages/*) push_packages: packages $(packages) rm -rf output && mkdir -p output/ $(foreach pkg,$(packages),$(CROSSPLANE) xpkg build --package-root=$(pkg) --package-file=output/$(patsubst packages/%,%,$(pkg)).xpkg;) - $(foreach pkg,$(packages),$(CROSSPLANE) xpkg push -f output/$(patsubst packages/%,%,$(pkg)).xpkg registry.upbound.io/grafana/$(patsubst packages/%,%,$(pkg)):$(LIBRARY_VERSION)-$(PROVIDER_VERSION);) + $(foreach pkg,$(packages),$(CROSSPLANE) xpkg push -f output/$(patsubst packages/%,%,$(pkg)).xpkg $(REGISTRY)/grafana/crossplane/$(patsubst packages/%,%,$(pkg)):$(LIBRARY_VERSION)-$(PROVIDER_VERSION);) docs: $(shell find grafanaplane/ -type f) @rm -rf docs/