This commit is contained in:
+11
-8
@@ -2,20 +2,27 @@
|
|||||||
set -xeuo pipefail
|
set -xeuo pipefail
|
||||||
|
|
||||||
main() {
|
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)"
|
TMPDIR="$(mktemp -d)"
|
||||||
echo "Using temp dir: ${TMPDIR}"
|
echo "Using temp dir: ${TMPDIR}"
|
||||||
|
|
||||||
cd "${TMPDIR}"
|
cd "${TMPDIR}"
|
||||||
mkdir golang
|
mkdir golang
|
||||||
cd 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"
|
GOLANG_URL="https://go.dev/dl/${GO_VERSION}.linux-amd64.tar.gz"
|
||||||
wget "${GOLANG_URL}"
|
wget "${GOLANG_URL}"
|
||||||
tar xzf "${GO_VERSION}.linux-amd64.tar.gz"
|
tar xzf "${GO_VERSION}.linux-amd64.tar.gz"
|
||||||
PATH="${PATH}:$PWD/go/bin"
|
PATH="${PATH}:$PWD/go/bin"
|
||||||
|
|
||||||
# 2. Clone latest CoreDNS release
|
# 3. Clone latest CoreDNS release
|
||||||
cd "${TMPDIR}"
|
cd "${TMPDIR}"
|
||||||
COREDNS_REPO_URL="https://github.com/coredns/coredns.git"
|
COREDNS_REPO_URL="https://github.com/coredns/coredns.git"
|
||||||
COREDNS_DIR="${TMPDIR}/coredns"
|
COREDNS_DIR="${TMPDIR}/coredns"
|
||||||
@@ -28,11 +35,6 @@ main() {
|
|||||||
git fetch --tags --depth=1 origin "${LATEST_TAG}"
|
git fetch --tags --depth=1 origin "${LATEST_TAG}"
|
||||||
git checkout "${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
|
# 4. cd into the CoreDNS repo
|
||||||
cd "${COREDNS_DIR}"
|
cd "${COREDNS_DIR}"
|
||||||
|
|
||||||
@@ -50,6 +52,7 @@ main() {
|
|||||||
mv plugin.cfg.new plugin.cfg
|
mv plugin.cfg.new plugin.cfg
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
go mod edit -go=$(echo GO_VERSION | sed 's/^go//')
|
||||||
# 6. go mod replace plugin path to the cloned action repo
|
# 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]
|
# 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.
|
# Adjust relative path if your repo layout differs.
|
||||||
|
|||||||
Reference in New Issue
Block a user