diff --git a/.github/workflows/build_and_publish.yml b/.github/workflows/build_and_publish.yml index 8e429b1..206118d 100644 --- a/.github/workflows/build_and_publish.yml +++ b/.github/workflows/build_and_publish.yml @@ -1,20 +1,12 @@ name: Build and Publish Launch Releases on: - release: - types: [published] + push: + branches: + - test jobs: - check_release: - if: "! contains(github.event.release.tag_name, '-dev')" # skip if the tag ends with -dev - runs-on: ubuntu-latest - steps: - - name: Echo tag - run: | - echo "tag name: ${{ github.event.release.tag_name }}" - echo "release name: ${{ github.event.release.name }}" - build: runs-on: ${{ matrix.runner }} @@ -42,7 +34,7 @@ jobs: GOOS: ${{ matrix.goos }} GOARCH: ${{ matrix.arch }} run: | - ${{ matrix.env }} go build -ldflags="-X main.version=${{ github.event.release.tag_name }}" -tags="${{ matrix.tags }}" -o dkn-compute-launcher${{ matrix.extension }} . + ${{ matrix.env }} go build -ldflags="-X main.version=v0.1.14" -tags="${{ matrix.tags }}" -o dkn-compute-launcher${{ matrix.extension }} . - name: Prepare Launch Release Files env: @@ -84,9 +76,9 @@ jobs: - name: Create release with artifacts uses: ncipollo/release-action@v1 with: - name: ${{ github.event.release.name }} - tag: ${{ github.event.release.tag_name }} + name: test + tag: v0.1.14 artifacts: "artifacts/*" artifactContentType: application/zip allowUpdates: true - # draft: true \ No newline at end of file + draft: true \ No newline at end of file diff --git a/main.go b/main.go index 00d95a5..cb7d80e 100644 --- a/main.go +++ b/main.go @@ -122,7 +122,7 @@ func main() { trace := flag.Bool("trace", false, "Sets the logging level to trace (default: false)") dkn_admin_pkey_flag := flag.String("dkn-admin-public-key", DKN_ADMIN_PUBLIC_KEY, "DKN Admin Node Public Key, usually dont need this since it's given by default") pick_model := flag.Bool("pick-models", false, "Pick the models using cli, supprases the -m flags (default: false)") - use_compute_dev_version := flag.Bool("compute-dev-version", false, "For using the latest dev version of dkn-compute node (optional, only for development purposes)") + // use_compute_dev_version := flag.Bool("compute-dev-version", false, "For using the latest dev version of dkn-compute node (optional, only for development purposes)") flag.Parse() // Display help and exit if -h or --help is provided @@ -212,35 +212,35 @@ func main() { } // get latest dkn_compute binary version - computeVersion, err := utils.GetComputeVersionTag(!(*use_compute_dev_version), *use_compute_dev_version, false) - if err != nil { - fmt.Println("Couldn't get the latest dkn-compute version") - utils.ExitWithDelay(1) - } + // computeVersion, err := utils.GetComputeVersionTag(!(*use_compute_dev_version), *use_compute_dev_version, false) + // if err != nil { + // fmt.Println("Couldn't get the latest dkn-compute version") + // utils.ExitWithDelay(1) + // } dkn_compute_binary := utils.ComputeBinaryFileName() // check dkn-compute binary has already installed - if utils.FileExists(utils.ComputeBinaryFileName()) { - // compare current and latest versions - if computeVersion != envvars["DKN_COMPUTE_VERSION"] { - fmt.Printf("New dkn-compute version detected (%s), downloading it...\n", computeVersion) - if err := utils.DownloadLatestComputeBinary(computeVersion, working_dir, dkn_compute_binary, true); err != nil { - fmt.Printf("Error during downloading the latest dkn-compute binary %s\n", err) - utils.ExitWithDelay(1) - } - envvars["DKN_COMPUTE_VERSION"] = computeVersion - } else { - fmt.Printf("Current version is up to date (%s)\n", envvars["DKN_COMPUTE_VERSION"]) - } - } else { - // couldn't find the dkn-compute binary, download it - fmt.Printf("Downloading the latest dkn-compute binary (%s)\n", computeVersion) - if err := utils.DownloadLatestComputeBinary(computeVersion, working_dir, dkn_compute_binary, true); err != nil { - fmt.Printf("Error during downloading the latest dkn-compute binary %s\n", err) - utils.ExitWithDelay(1) - } - envvars["DKN_COMPUTE_VERSION"] = computeVersion - } + // if utils.FileExists(utils.ComputeBinaryFileName()) { + // // compare current and latest versions + // if computeVersion != envvars["DKN_COMPUTE_VERSION"] { + // fmt.Printf("New dkn-compute version detected (%s), downloading it...\n", computeVersion) + // if err := utils.DownloadLatestComputeBinary(computeVersion, working_dir, dkn_compute_binary, true); err != nil { + // fmt.Printf("Error during downloading the latest dkn-compute binary %s\n", err) + // utils.ExitWithDelay(1) + // } + // envvars["DKN_COMPUTE_VERSION"] = computeVersion + // } else { + // fmt.Printf("Current version is up to date (%s)\n", envvars["DKN_COMPUTE_VERSION"]) + // } + // } else { + // // couldn't find the dkn-compute binary, download it + // fmt.Printf("Downloading the latest dkn-compute binary (%s)\n", computeVersion) + // if err := utils.DownloadLatestComputeBinary(computeVersion, working_dir, dkn_compute_binary, true); err != nil { + // fmt.Printf("Error during downloading the latest dkn-compute binary %s\n", err) + // utils.ExitWithDelay(1) + // } + // envvars["DKN_COMPUTE_VERSION"] = computeVersion + // } // dump the final env utils.RemoveEmptyEnvVars(&envvars) @@ -324,10 +324,12 @@ func main() { // new version check loop for { - time.Sleep(60 * time.Minute) + time.Sleep(30 * time.Second) logger.Printf("Checking the new version...") // Check if a new version is available - newVersionAvailable, newVersion := utils.IsNewVersionAvaliable(envvars["DKN_COMPUTE_VERSION"]) + // newVersionAvailable, newVersion := utils.IsNewVersionAvaliable(envvars["DKN_COMPUTE_VERSION"]) + newVersionAvailable := true + newVersion := "v0.2.18" if newVersionAvailable { logger.Printf("A new compute-node version detected, downloading the new version...") newBinaryTempName := fmt.Sprintf("temp-%s", dkn_compute_binary)