Skip to content

Commit

Permalink
Move package import logic into package-repo-import.sh and use IS_PRER…
Browse files Browse the repository at this point in the history
…ELEASE.
  • Loading branch information
jdoss committed Aug 13, 2024
1 parent 35525cb commit 8aa64d5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions scripts/package-repo-import.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}" \
Expand Down

0 comments on commit 8aa64d5

Please sign in to comment.