diff --git a/.github/workflows/bundle.yml b/.github/workflows/bundle.yml index 1fc73f7..bef1150 100644 --- a/.github/workflows/bundle.yml +++ b/.github/workflows/bundle.yml @@ -54,6 +54,12 @@ jobs: tmp/*.image tmp/*.changes + - name: Export global environment + uses: actions/upload-artifact@v2 + with: + name: ${{ matrix.smalltalk }}-env + path: tmp/global-env + test-image: needs: [prepare-image] @@ -76,6 +82,12 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Import global environment + uses: actions/download-artifact@v2 + with: + name: ${{ matrix.smalltalk }}-env + path: tmp + - name: Download artifacts uses: actions/download-artifact@v2 with: @@ -120,12 +132,18 @@ jobs: name: 📦 Prepare bundles for ${{ matrix.smalltalk }} env: SMALLTALK_VERSION: ${{ matrix.smalltalk }} - SHOULD_DEPLOY: endsWith(github.ref, "squeak-trunk") - SHOULD_CODESIGN: env.SHOULD_DEPLOY + SHOULD_DEPLOY: ${{ endsWith(github.ref, 'squeak-trunk') }} + SHOULD_CODESIGN: ${{ endsWith(github.ref, 'squeak-trunk') }} steps: - uses: actions/checkout@v2 + - name: Import global environment + uses: actions/download-artifact@v2 + with: + name: ${{ matrix.smalltalk }}-env + path: tmp + - name: Download artifacts uses: actions/download-artifact@v2 with: @@ -148,7 +166,7 @@ jobs: path: product/* - run: ./deploy_bundles.sh - if: env.SHOULD_DEPLOY + if: env.SHOULD_DEPLOY == 'true' env: DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} DEPLOY_IV: ${{ secrets.DEPLOY_IV }} diff --git a/helpers.sh b/helpers.sh index 71c2ead..cad0956 100644 --- a/helpers.sh +++ b/helpers.sh @@ -80,11 +80,20 @@ export_variable() { local var_value=$2 if [[ ! -z ${GITHUB_ENV} ]]; then echo "${var_name}=${var_value}" >> $GITHUB_ENV + echo "${var_name}=${var_value}" >> $GLOBAL_ENV else print_warning "...skipping export of $var_name outside GitHub Actions..." fi } +import_variables() { + if is_file $GLOBAL_ENV; then + source $GLOBAL_ENV + else + echo "No global variables to import." + fi +} + prepare_platform_vm() { case $RUNNER_OS in "Windows") @@ -161,6 +170,10 @@ readonly PRODUCT_PATH="${HOME_PATH}/product" readonly TMP_PATH="${HOME_PATH}/tmp" mkdir -p "${BUILD_PATH}" "${PRODUCT_PATH}" "${TMP_PATH}" +# Communicate variables beyond a single action +readonly GLOBAL_ENV="${TMP_PATH}/global-env" +import_variables + # Assure $RUNNER_OS if not invoked from within GitHub Actions if [[ -z "${RUNNER_OS}" ]]; then case $(uname -s) in diff --git a/prepare_bundles.sh b/prepare_bundles.sh index e180082..2cb706e 100755 --- a/prepare_bundles.sh +++ b/prepare_bundles.sh @@ -31,6 +31,10 @@ set -o errexit +source "env_vars" +source "helpers.sh" +source "helpers_bundles.sh" + [[ -z "${SMALLTALK_VERSION}" ]] && exit 2 [[ -z "${SHOULD_CODESIGN}" ]] && exit 3 @@ -38,10 +42,6 @@ set -o errexit [[ -z "${SQUEAK_UPDATE}" ]] && exit 5 [[ -z "${IMAGE_BITS}" ]] && exit 6 -source "env_vars" -source "helpers.sh" -source "helpers_bundles.sh" - readonly TEMPLATE_PATH="${HOME_PATH}/templates" readonly AIO_TEMPLATE_PATH="${TEMPLATE_PATH}/all-in-one" readonly LIN_TEMPLATE_PATH="${TEMPLATE_PATH}/linux" diff --git a/test_image.sh b/test_image.sh index 03aba28..4785e0a 100755 --- a/test_image.sh +++ b/test_image.sh @@ -19,12 +19,12 @@ set -o errexit -[[ -z "${SMALLTALK_VERSION}" ]] && exit 2 -[[ -z "${SMALLTALK_CI_HOME}" ]] && exit 3 - source "env_vars" source "helpers.sh" +[[ -z "${SMALLTALK_VERSION}" ]] && exit 2 +[[ -z "${SMALLTALK_CI_HOME}" ]] && exit 3 + readonly SCI_PATH="${HOME_PATH}/smalltalk-ci" test_image() {