From 8aa64d5364be72c46b55f390c61eedf4b4baf1a6 Mon Sep 17 00:00:00 2001 From: Joe Doss Date: Tue, 13 Aug 2024 14:04:39 -0500 Subject: [PATCH] Move package import logic into package-repo-import.sh and use IS_PRERELEASE. --- .github/workflows/release.yml | 3 ++- .goreleaser.yml | 2 +- scripts/package-repo-import.sh | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ce8509844..ed787ac92 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -68,9 +68,10 @@ jobs: id-token: write contents: write packages: write - uses: smallstep/workflows/.github/workflows/goreleaser.yml@main + uses: smallstep/workflows/.github/workflows/goreleaser.yml@jdoss/PRERELEASE_env_var with: enable-packages-upload: true + is_prerelease: ${{ needs.create_release.outputs.is_prerelease }} secrets: inherit build_upload_docker: diff --git a/.goreleaser.yml b/.goreleaser.yml index 0fae972d9..c23479e51 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -13,6 +13,7 @@ before: after: hooks: + # This script depends on IS_PRERELEASE env being set. This is set by CI in the Is Pre-release step. - cmd: bash scripts/package-repo-import.sh {{ .Var.packageName }} {{ .Version }} output: true @@ -161,7 +162,6 @@ publishers: ids: - packages cmd: ./scripts/package-upload.sh {{ abs .ArtifactPath }} {{ .Var.packageName }} {{ .Version }} {{ .Var.packageRelease }} - disable: "{{ if .Prerelease }}true{{ end }}" snapshot: name_template: "{{ .Tag }}-next" diff --git a/scripts/package-repo-import.sh b/scripts/package-repo-import.sh index 89ab5ab21..b930187ea 100755 --- a/scripts/package-repo-import.sh +++ b/scripts/package-repo-import.sh @@ -45,6 +45,11 @@ if [[ ${GORELEASER_PHASE} != "publish" ]]; then exit 0; fi +if [[ ${IS_PRERELEASE} == "true" ]]; then + echo "Skipping artifact import; IS_PRERELEASE is 'true'" + exit 0; +fi + check_package "${GCLOUD_RPM_REPO}" "${EPOCH}:${VERSION}-${RELEASE}" gcloud artifacts yum import "${GCLOUD_RPM_REPO}" \ --location "${GCLOUD_LOCATION}" \