diff --git a/ci/build.sh b/ci/build.sh index 937503e..54d97a9 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -2,20 +2,27 @@ set -xeuo pipefail main() { - # 1. Create temp directory + GO_VERSION=$(curl -s 'https://go.dev/VERSION?m=text' | head -n1) + + # 1. + ACTION_REPO_DIR="${PWD}" + go mod edit -go=$(echo GO_VERSION | sed 's/^go//') + #mkdir "${ACTION_REPO_DIR}" + #cp -a . "${ACTION_REPO_DIR}/" + + # 2. Create temp directory TMPDIR="$(mktemp -d)" echo "Using temp dir: ${TMPDIR}" cd "${TMPDIR}" mkdir golang cd golang - GO_VERSION=$(curl -s 'https://go.dev/VERSION?m=text' | head -n1) GOLANG_URL="https://go.dev/dl/${GO_VERSION}.linux-amd64.tar.gz" wget "${GOLANG_URL}" tar xzf "${GO_VERSION}.linux-amd64.tar.gz" PATH="${PATH}:$PWD/go/bin" - # 2. Clone latest CoreDNS release + # 3. Clone latest CoreDNS release cd "${TMPDIR}" COREDNS_REPO_URL="https://github.com/coredns/coredns.git" COREDNS_DIR="${TMPDIR}/coredns" @@ -28,11 +35,6 @@ main() { git fetch --tags --depth=1 origin "${LATEST_TAG}" git checkout "${LATEST_TAG}" - # 3. Clone the GitHub Action's repo (this repo) - ACTION_REPO_DIR="${TMPDIR}/action-repo" - mkdir "${ACTION_REPO_DIR}" - cp -a . "${ACTION_REPO_DIR}/" - # 4. cd into the CoreDNS repo cd "${COREDNS_DIR}" @@ -50,6 +52,7 @@ main() { mv plugin.cfg.new plugin.cfg fi + go mod edit -go=$(echo GO_VERSION | sed 's/^go//') # 6. go mod replace plugin path to the cloned action repo # This assumes the plugin lives at github.com/doubleu-labs/coredns-netbox-plugin-dns in your repo. [web:16][web:23] # Adjust relative path if your repo layout differs.