diff --git a/.github/pipeline-version b/.github/pipeline-version index 3989355..2844977 100644 --- a/.github/pipeline-version +++ b/.github/pipeline-version @@ -1 +1 @@ -1.20.0 +1.21.1 diff --git a/.github/workflows/create-package.yml b/.github/workflows/create-package.yml index a0424ad..d18a7eb 100644 --- a/.github/workflows/create-package.yml +++ b/.github/workflows/create-package.yml @@ -91,6 +91,11 @@ jobs: set -euo pipefail + if [ -z "${GITHUB_REF+set}" ]; then + echo "GITHUB_REF set to [${GITHUB_REF-}], but should never be empty or unset" + exit 255 + fi + if [[ ${GITHUB_REF} =~ refs/tags/v([0-9]+\.[0-9]+\.[0-9]+) ]]; then VERSION=${BASH_REMATCH[1]} @@ -140,11 +145,16 @@ jobs: VERSION: ${{ steps.version.outputs.version }} - name: Package Buildpack id: package - run: | + run: |- #!/usr/bin/env bash set -euo pipefail + + PACKAGE_LIST=($PACKAGES) + # Extract first repo (Docker Hub) as the main to package & register + PACKAGE=${PACKAGE_LIST[0]} + if [[ "${PUBLISH:-x}" == "true" ]]; then pack buildpack package \ "${PACKAGE}:${VERSION}" \ @@ -157,6 +167,20 @@ jobs: fi crane tag "${PACKAGE}:${VERSION}" latest echo "::set-output name=digest::$(crane digest "${PACKAGE}:${VERSION}")" + + # copy to other repositories specified + for P in "${PACKAGE_LIST[@]}" + do + if [ "$P" != "$PACKAGE" ]; then + crane copy "${PACKAGE}:${VERSION}" "${P}:${VERSION}" + if [[ -n ${VERSION_MINOR:-} && -n ${VERSION_MAJOR:-} ]]; then + crane tag "${P}:${VERSION}" "${VERSION_MINOR}" + crane tag "${P}:${VERSION}" "${VERSION_MAJOR}" + fi + crane tag "${P}:${VERSION}" latest + fi + done + else pack buildpack package \ "${PACKAGE}:${VERSION}" \ @@ -164,7 +188,7 @@ jobs: --format "${FORMAT}" fi env: - PACKAGE: gcr.io/paketo-buildpacks/upx + PACKAGES: gcr.io/paketo-buildpacks/upx PUBLISH: "true" VERSION: ${{ steps.version.outputs.version }} VERSION_MAJOR: ${{ steps.version.outputs.version-major }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2bd4e16..263ade8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -65,6 +65,11 @@ jobs: set -euo pipefail + if [ -z "${GITHUB_REF+set}" ]; then + echo "GITHUB_REF set to [${GITHUB_REF-}], but should never be empty or unset" + exit 255 + fi + if [[ ${GITHUB_REF} =~ refs/tags/v([0-9]+\.[0-9]+\.[0-9]+) ]]; then VERSION=${BASH_REMATCH[1]} @@ -112,11 +117,16 @@ jobs: OS: linux VERSION: ${{ steps.version.outputs.version }} - name: Package Buildpack - run: | + run: |- #!/usr/bin/env bash set -euo pipefail + + PACKAGE_LIST=($PACKAGES) + # Extract first repo (Docker Hub) as the main to package & register + PACKAGE=${PACKAGE_LIST[0]} + if [[ "${PUBLISH:-x}" == "true" ]]; then pack buildpack package \ "${PACKAGE}:${VERSION}" \ @@ -129,6 +139,20 @@ jobs: fi crane tag "${PACKAGE}:${VERSION}" latest echo "::set-output name=digest::$(crane digest "${PACKAGE}:${VERSION}")" + + # copy to other repositories specified + for P in "${PACKAGE_LIST[@]}" + do + if [ "$P" != "$PACKAGE" ]; then + crane copy "${PACKAGE}:${VERSION}" "${P}:${VERSION}" + if [[ -n ${VERSION_MINOR:-} && -n ${VERSION_MAJOR:-} ]]; then + crane tag "${P}:${VERSION}" "${VERSION_MINOR}" + crane tag "${P}:${VERSION}" "${VERSION_MAJOR}" + fi + crane tag "${P}:${VERSION}" latest + fi + done + else pack buildpack package \ "${PACKAGE}:${VERSION}" \ @@ -137,7 +161,7 @@ jobs: fi env: FORMAT: image - PACKAGE: test + PACKAGES: test VERSION: ${{ steps.version.outputs.version }} unit: name: Unit Test