From 86eba2506a2859d795570e86dfd24f7de4e82c08 Mon Sep 17 00:00:00 2001 From: Jason Swank Date: Mon, 1 May 2023 14:01:27 -0400 Subject: [PATCH] update publish process --- .build.yml | 5 +++-- justfile | 21 ++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.build.yml b/.build.yml index d7e2b1c..7927017 100644 --- a/.build.yml +++ b/.build.yml @@ -31,5 +31,6 @@ tasks: # - sudo --preserve-env is required to pass environment variables - publish: | cd alpine-cli - chpst -e ~/.envdir sudo --preserve-env just publish - chpst -e ~/.envdir sudo --preserve-env just publish-dh + chpst -e ~/.envdir sudo --preserve-env just registry_pass_var=GH_PAT publish + chpst -e ~/.envdir sudo --preserve-env just registry=docker.io registry_pass_var=DH_PAT publish + chpst -e ~/.envdir sudo --preserve-env just registry=quay.io registry_pass_var=QUAY_PAT publish diff --git a/justfile b/justfile index ecefa2d..b5e732d 100644 --- a/justfile +++ b/justfile @@ -2,21 +2,20 @@ set dotenv-load image := "jswank/alpine-cli:latest" +registry := "ghcr.io" +registry_user := "jswank" + +# this environment variable will be passed to podman login as the password +registry_pass_var := "REGISTRY_PASSWORD" + # build a new image build: podman build -t {{image}} -f Dockerfile ctx # publish the image publish: - @ podman tag {{image}} ghcr.io/{{image}} - @ echo $GH_PAT | podman login ghcr.io -u jswank --password-stdin >/dev/null 2>&1 - podman push ghcr.io/{{image}} - @ podman logout ghcr.io - -# publish the image to Dockerhub / docker.io -publish-dh: - @ podman tag {{image}} docker.io/{{image}} - @ echo $DH_PAT | podman login docker.io -u jswank --password-stdin >/dev/null 2>&1 - podman push docker.io/{{image}} - @ podman logout docker.io + @ podman tag {{image}} {{registry}}/{{image}} + @ echo "${{ registry_pass_var }}" | podman login {{registry}} -u {{registry_user}} --password-stdin + @ podman push {{registry}}/{{image}} + @ podman logout {{registry}}