diff --git a/action.yml b/action.yml index f793f1d..479c8f4 100644 --- a/action.yml +++ b/action.yml @@ -74,21 +74,6 @@ runs: - name: "Bootstrap Dataverse service" id: bootstrap shell: bash + working-directory: ${{ github.action_path }}/scripts run: | - echo "::group::🤖 Bootstrap Dataverse service" - mkdir -p "${RUNNER_TEMP}/dv" - touch "${RUNNER_TEMP}/dv/bootstrap.exposed.env" - - docker run -i --network apitest_dataverse \ - -v "${RUNNER_TEMP}/dv/bootstrap.exposed.env:/.env" \ - "${CONFIGBAKER_IMAGE}" bootstrap.sh -e /.env dev - - # Expose outputs - grep "API_TOKEN" "${RUNNER_TEMP}/dv/bootstrap.exposed.env" >> "$GITHUB_OUTPUT" - echo "base_url=http://localhost:8080/" >> "$GITHUB_OUTPUT" - - # Expose version - version=$(curl -s 'http://localhost:8080/api/info/version' | jq -r '.data.version') - echo "dv_version=$version" >>"$GITHUB_OUTPUT" - - echo "::endgroup::" + ./bootstrap.sh diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh new file mode 100644 index 0000000..05733fc --- /dev/null +++ b/scripts/bootstrap.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +set -euo pipefail + +RUNNER_TEMP=${RUNNER_TEMP:?Must define RUNNER_TEMP env variable before running this script} +CONFIGBAKER_IMAGE=${CONFIGBAKER_IMAGE:?Must define CONFIGBAKER_IMAGE env variable before running this script} +GITHUB_OUTPUT=${GITHUB_OUTPUT:-$(mktemp)} + +mkdir -p "${RUNNER_TEMP}/dv" +touch "${RUNNER_TEMP}/dv/bootstrap.exposed.env" + +echo "::group::🤖 Bootstrap Dataverse service" + +docker run -i --network apitest_dataverse \ + -v "${RUNNER_TEMP}/dv/bootstrap.exposed.env:/.env" \ + "${CONFIGBAKER_IMAGE}" bootstrap.sh -e /.env dev + +echo "::endgroup::" + +# Expose outputs +grep "API_TOKEN" "${RUNNER_TEMP}/dv/bootstrap.exposed.env" >> "$GITHUB_OUTPUT" +echo "base_url=http://localhost:8080/" >> "$GITHUB_OUTPUT" + +# Expose version +version=$(curl -s 'http://localhost:8080/api/info/version' | jq -r '.data.version') +echo "dv_version=$version" >>"$GITHUB_OUTPUT"