Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ cd ../frontend
npm install

# Create .env.local for devcontainer
if [ -n "$CODESPACE_NAME" ]; then
# GitHub Codespaces
CODESPACE_URL="https://${CODESPACE_NAME}-8080.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}"
echo "📝 Creating .env.local with Codespace URL..."
echo "NEXT_PUBLIC_API_URL=${CODESPACE_URL}/api/v1" >.env.local
echo "✅ .env.local created with Codespace URL: ${CODESPACE_URL}/api/v1"
if [ -n "${CODESPACE_NAME}" ]; then
# GitHub Codespaces
CODESPACE_URL="https://${CODESPACE_NAME}-8080.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}"
echo "📝 Creating .env.local with Codespace URL..."
echo "NEXT_PUBLIC_API_URL=${CODESPACE_URL}/api/v1" >.env.local
echo "✅ .env.local created with Codespace URL: ${CODESPACE_URL}/api/v1"
else
# Local devcontainer or other environment
echo "📝 Creating .env.local for local development..."
echo "NEXT_PUBLIC_API_URL=http://localhost:8000/api/v1" >.env.local
echo "✅ .env.local created with local URL"
# Local devcontainer or other environment
echo "📝 Creating .env.local for local development..."
echo "NEXT_PUBLIC_API_URL=http://localhost:8000/api/v1" >.env.local
echo "✅ .env.local created with local URL"
fi

echo "✅ Frontend setup complete!"
Expand Down
6 changes: 3 additions & 3 deletions .devcontainer/post-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ nohup npm run dev >/tmp/frontend-dev.log 2>&1 &
sleep 3

if pgrep -f "next dev" >/dev/null; then
echo "✅ Frontend dev server started at http://localhost:8080"
echo "📋 View logs: tail -f /tmp/frontend-dev.log"
echo "✅ Frontend dev server started at http://localhost:8080"
echo "📋 View logs: tail -f /tmp/frontend-dev.log"
else
echo "⚠️ Frontend dev server failed to start. Check logs: cat /tmp/frontend-dev.log"
echo "⚠️ Frontend dev server failed to start. Check logs: cat /tmp/frontend-dev.log"
fi

echo ""
Expand Down
15 changes: 12 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
# top-most EditorConfig file
; https://editorconfig.org/

root = true

[*.ext]
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

indent_style = space
[*.md]
indent_size = 4
trim_trailing_whitespace = false

[*.sh]
indent_size = 4
8 changes: 4 additions & 4 deletions .github/scripts/check-if-prerelease.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ VERSION="$1"
MANUAL_PRERELEASE="${2:-false}"

# Extract version without v prefix
VERSION_NUM=$(echo "$VERSION" | grep -oP '\d+\.\d+\.\d+.*' || echo "$VERSION")
VERSION_NUM=$(echo "${VERSION}" | grep -oP '\d+\.\d+\.\d+.*' || echo "${VERSION}")

# Check if version contains prerelease identifiers or if manually set
if [[ "$MANUAL_PRERELEASE" == "true" ]] || [[ "$VERSION_NUM" =~ -alpha|-beta|-rc|-pre ]]; then
echo "is_prerelease=true"
if [[ "${MANUAL_PRERELEASE}" == "true" ]] || [[ "${VERSION_NUM}" =~ -alpha|-beta|-rc|-pre ]]; then
echo "is_prerelease=true"
else
echo "is_prerelease=false"
echo "is_prerelease=false"
fi
8 changes: 4 additions & 4 deletions .github/scripts/cleanup-containers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
set -e

if [ $# -eq 0 ]; then
echo "Usage: $0 <container1> [container2] [container3...]"
exit 1
echo "Usage: $0 <container1> [container2] [container3...]"
exit 1
fi

for CONTAINER in "$@"; do
echo "Removing container ${CONTAINER}..."
docker rm -f "${CONTAINER}" 2>&1 || true
echo "Removing container ${CONTAINER}..."
docker rm -f "${CONTAINER}" 2>&1 || true
done

echo "✓ Cleanup complete"
16 changes: 8 additions & 8 deletions .github/scripts/create-github-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ set -euo pipefail

# Fetch auto-generated release notes from GitHub API
GENERATED_NOTES=$(gh api \
--method POST \
"/repos/${GITHUB_REPOSITORY}/releases/generate-notes" \
-f "tag_name=${VERSION_TAG}" \
--jq '.body')
--method POST \
"/repos/${GITHUB_REPOSITORY}/releases/generate-notes" \
-f "tag_name=${VERSION_TAG}" \
--jq '.body')

# Write the full release notes to a temp file
RELEASE_NOTES_FILE=$(mktemp)
Expand All @@ -34,13 +34,13 @@ EOF

# Build gh CLI argument list
GH_ARGS=(
"${VERSION_TAG}"
--title "${VERSION}"
--notes-file "${RELEASE_NOTES_FILE}"
"${VERSION_TAG}"
--title "${VERSION}"
--notes-file "${RELEASE_NOTES_FILE}"
)

if [[ "${IS_PRERELEASE}" == "true" ]]; then
GH_ARGS+=(--prerelease)
GH_ARGS+=(--prerelease)
fi

gh release create "${GH_ARGS[@]}"
7 changes: 4 additions & 3 deletions .github/scripts/download-search-index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ SEARCH_INDEX_URL="${SEARCH_INDEX_URL:-https://github.com/${GITHUB_REPOSITORY}/re
mkdir -p "$(dirname "${SEARCH_INDEX_PATH}")"

if curl -fsSL "${SEARCH_INDEX_URL}" -o "${SEARCH_INDEX_PATH}"; then
echo "Downloaded search index from ${SEARCH_INDEX_URL}"
exit 0
echo "Downloaded search index from ${SEARCH_INDEX_URL}"
exit 0
fi

echo "Warning: could not download ${SEARCH_INDEX_URL}; writing empty search index."
generated_at="$(date -u +%Y-%m-%dT%H:%M:%SZ || true)"
cat >"${SEARCH_INDEX_PATH}" <<EOF
{"version":1,"generated_at":"$(date -u +%Y-%m-%dT%H:%M:%SZ)","statistics":{"total_repositories":0,"total_automations":0,"last_indexed_at":null,"repo_star_count":0},"automations":[]}
{"version":1,"generated_at":"${generated_at}","statistics":{"total_repositories":0,"total_automations":0,"last_indexed_at":null,"repo_star_count":0},"automations":[]}
EOF
44 changes: 22 additions & 22 deletions .github/scripts/extract-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,29 @@ EVENT_NAME="${1}"
PR_NUMBER="${2}"
GIT_REF="${3}"

if [ "$EVENT_NAME" = "pull_request" ]; then
# For PRs, use format: 0.0.0-pr.<number>.<short-sha>
if [ -z "$PR_NUMBER" ]; then
echo "Error: PR_NUMBER required for pull_request event"
exit 1
fi
SHORT_SHA=$(git rev-parse --short HEAD)
VERSION="0.0.0-pr.${PR_NUMBER}.${SHORT_SHA}"
VERSION_TAG="pr-${PR_NUMBER}"
elif [ "$EVENT_NAME" = "workflow_dispatch" ]; then
if [ -z "$INPUT_VERSION" ]; then
echo "Error: version input required for workflow_dispatch event"
exit 1
fi
VERSION="${PR_NUMBER}" # PR_NUMBER is actually INPUT_VERSION for workflow_dispatch
VERSION_TAG="v${VERSION}"
elif [ -n "$GIT_REF" ]; then
# Extract version from tag (e.g., v1.0.0 -> 1.0.0)
VERSION=${GIT_REF#refs/tags/v}
VERSION_TAG=${GIT_REF#refs/tags/}
if [ "${EVENT_NAME}" = "pull_request" ]; then
# For PRs, use format: 0.0.0-pr.<number>.<short-sha>
if [ -z "${PR_NUMBER}" ]; then
echo "Error: PR_NUMBER required for pull_request event"
exit 1
fi
SHORT_SHA=$(git rev-parse --short HEAD)
VERSION="0.0.0-pr.${PR_NUMBER}.${SHORT_SHA}"
VERSION_TAG="pr-${PR_NUMBER}"
elif [ "${EVENT_NAME}" = "workflow_dispatch" ]; then
if [ -z "${INPUT_VERSION}" ]; then
echo "Error: version input required for workflow_dispatch event"
exit 1
fi
VERSION="${PR_NUMBER}" # PR_NUMBER is actually INPUT_VERSION for workflow_dispatch
VERSION_TAG="v${VERSION}"
elif [ -n "${GIT_REF}" ]; then
# Extract version from tag (e.g., v1.0.0 -> 1.0.0)
VERSION=${GIT_REF#refs/tags/v}
VERSION_TAG=${GIT_REF#refs/tags/}
else
echo "Error: Invalid arguments for event $EVENT_NAME"
exit 1
echo "Error: Invalid arguments for event ${EVENT_NAME}"
exit 1
fi

echo "version=${VERSION}"
Expand Down
44 changes: 22 additions & 22 deletions .github/scripts/publish-db-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ LATEST_TAG="db-latest"
DATED_TAG="db-$(date -u +%Y-%m-%d)"

if [ ! -f "${DB_FILE}" ]; then
echo "Error: Database file '${DB_FILE}' not found."
exit 1
echo "Error: Database file '${DB_FILE}' not found."
exit 1
fi

if [ ! -f "${SEARCH_INDEX_FILE}" ]; then
echo "Error: Search index file '${SEARCH_INDEX_FILE}' not found."
exit 1
echo "Error: Search index file '${SEARCH_INDEX_FILE}' not found."
exit 1
fi

RELEASE_BODY="Static search data and archived SQLite database updated by GitHub Actions.
Expand All @@ -46,30 +46,30 @@ https://github.com/${GITHUB_REPOSITORY}/releases/download/${LATEST_TAG}/hadiscov

# --- Rolling latest release ---
if gh release view "${LATEST_TAG}" &>/dev/null; then
echo "Updating existing '${LATEST_TAG}' release assets..."
gh release upload "${LATEST_TAG}" "${DB_FILE}" "${SEARCH_INDEX_FILE}" --clobber
echo "Updating existing '${LATEST_TAG}' release assets..."
gh release upload "${LATEST_TAG}" "${DB_FILE}" "${SEARCH_INDEX_FILE}" --clobber
else
echo "Creating '${LATEST_TAG}' release..."
gh release create "${LATEST_TAG}" \
--title "Latest Search Data" \
--notes "${RELEASE_BODY}" \
--prerelease \
"${DB_FILE}" \
"${SEARCH_INDEX_FILE}"
echo "Creating '${LATEST_TAG}' release..."
gh release create "${LATEST_TAG}" \
--title "Latest Search Data" \
--notes "${RELEASE_BODY}" \
--prerelease \
"${DB_FILE}" \
"${SEARCH_INDEX_FILE}"
fi
echo "✓ Published to '${LATEST_TAG}'"

# --- Dated snapshot release ---
if gh release view "${DATED_TAG}" &>/dev/null; then
echo "Updating existing '${DATED_TAG}' release assets..."
gh release upload "${DATED_TAG}" "${DB_FILE}" "${SEARCH_INDEX_FILE}" --clobber
echo "Updating existing '${DATED_TAG}' release assets..."
gh release upload "${DATED_TAG}" "${DB_FILE}" "${SEARCH_INDEX_FILE}" --clobber
else
echo "Creating '${DATED_TAG}' release..."
gh release create "${DATED_TAG}" \
--title "Search Data ${DATED_TAG#db-}" \
--notes "${RELEASE_BODY}" \
--prerelease \
"${DB_FILE}" \
"${SEARCH_INDEX_FILE}"
echo "Creating '${DATED_TAG}' release..."
gh release create "${DATED_TAG}" \
--title "Search Data ${DATED_TAG#db-}" \
--notes "${RELEASE_BODY}" \
--prerelease \
"${DB_FILE}" \
"${SEARCH_INDEX_FILE}"
fi
echo "✓ Published to '${DATED_TAG}'"
14 changes: 7 additions & 7 deletions .github/scripts/start-backend-container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ CONTAINER_NAME="${1}"
IMAGE_TAG="${2}"
PORT="${3:-8000}"

if [ -z "$CONTAINER_NAME" ] || [ -z "$IMAGE_TAG" ]; then
echo "Usage: $0 <container-name> <image-tag> [port]"
exit 1
if [ -z "${CONTAINER_NAME}" ] || [ -z "${IMAGE_TAG}" ]; then
echo "Usage: $0 <container-name> <image-tag> [port]"
exit 1
fi

echo "Starting backend container ${CONTAINER_NAME} from image ${IMAGE_TAG}..."

docker run -d \
--name "${CONTAINER_NAME}" \
-p "${PORT}:8000" \
-e ENVIRONMENT=development \
"${IMAGE_TAG}"
--name "${CONTAINER_NAME}" \
-p "${PORT}:8000" \
-e ENVIRONMENT=development \
"${IMAGE_TAG}"

echo "✓ Backend container ${CONTAINER_NAME} started"
18 changes: 9 additions & 9 deletions .github/scripts/start-container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ PORT_MAPPING="${3}"
shift 3
ADDITIONAL_ARGS="$*"

if [ -z "$CONTAINER_NAME" ] || [ -z "$IMAGE_TAG" ]; then
echo "Usage: $0 <container-name> <image-tag> <port-mapping> [additional-docker-run-args...]"
exit 1
if [ -z "${CONTAINER_NAME}" ] || [ -z "${IMAGE_TAG}" ]; then
echo "Usage: $0 <container-name> <image-tag> <port-mapping> [additional-docker-run-args...]"
exit 1
fi

echo "Starting container $CONTAINER_NAME from image $IMAGE_TAG..."
echo "Starting container ${CONTAINER_NAME} from image ${IMAGE_TAG}..."

# shellcheck disable=SC2086
docker run -d --name "$CONTAINER_NAME" \
-p "$PORT_MAPPING" \
$ADDITIONAL_ARGS \
"$IMAGE_TAG"
docker run -d --name "${CONTAINER_NAME}" \
-p "${PORT_MAPPING}" \
${ADDITIONAL_ARGS} \
"${IMAGE_TAG}"

echo "✓ Container $CONTAINER_NAME started"
echo "✓ Container ${CONTAINER_NAME} started"
14 changes: 7 additions & 7 deletions .github/scripts/start-integration-containers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ set -e
BACKEND_IMAGE="${1}"
FRONTEND_IMAGE="${2}"

if [ -z "$BACKEND_IMAGE" ] || [ -z "$FRONTEND_IMAGE" ]; then
echo "Usage: $0 <backend-image> <frontend-image>"
exit 1
if [ -z "${BACKEND_IMAGE}" ] || [ -z "${FRONTEND_IMAGE}" ]; then
echo "Usage: $0 <backend-image> <frontend-image>"
exit 1
fi

echo "Starting backend container..."
docker run -d \
--name hadiscover-backend \
-p 8000:8000 \
-e ENVIRONMENT=development \
"${BACKEND_IMAGE}"
--name hadiscover-backend \
-p 8000:8000 \
-e ENVIRONMENT=development \
"${BACKEND_IMAGE}"

echo "Starting frontend container..."
.github/scripts/start-container.sh hadiscover-frontend "${FRONTEND_IMAGE}" 8080:80
Expand Down
Loading
Loading