Skip to content

Commit

Permalink
feat(action): migrate bootstrapping step to script
Browse files Browse the repository at this point in the history
  • Loading branch information
poikilotherm committed Apr 8, 2024
1 parent 5fe76cf commit 2ce5cc1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 17 deletions.
19 changes: 2 additions & 17 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
26 changes: 26 additions & 0 deletions scripts/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 2ce5cc1

Please sign in to comment.