Browse Source

Merge pull request #1891 from gravitl/gra-851-nmctl-workflow

nmctl workflow
dcarns 2 years ago
parent
commit
62f05e7635
3 changed files with 73 additions and 1 deletions
  1. 56 0
      .github/workflows/buildandrelease.yml
  2. 16 0
      .github/workflows/test.yml
  3. 1 1
      cli/cmd/root.go

+ 56 - 0
.github/workflows/buildandrelease.yml

@@ -71,6 +71,62 @@ jobs:
           prerelease: true
           prerelease: true
           asset_name: netmaker
           asset_name: netmaker
 
 
+  nmctl:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v3
+      - name: Setup go
+        uses: actions/setup-go@v3
+        with:
+          go-version: 1.19
+      - name: Build
+        run: |
+          cd cli
+          GOOS=linux GOARCH=amd64 go build -o nmctl-linux-amd64
+          GOOS=darwin GOARCH=amd64 go build -o nmctl-darwin-amd64
+          GOOS=darwin GOARCH=arm64 go build -o nmctl-darwin-arm64
+          GOOS=windows GOARCH=amd64 go build -o nmctl-windows-amd64
+      - name: Upload nmctl-linux-amd64 to Release
+        continue-on-error: true
+        uses: svenstaro/upload-release-action@v2
+        with:
+          repo_token: ${{ secrets.GITHUB_TOKEN }}
+          file: cli/nmctl-linux-amd64
+          tag: ${{ env.NETMAKER_VERSION }}
+          overwrite: true
+          prerelease: true
+          asset_name: nmctl-linux-amd64
+      - name: Upload nmctl-darwin-amd64 to Release
+        continue-on-error: true
+        uses: svenstaro/upload-release-action@v2
+        with:
+          repo_token: ${{ secrets.GITHUB_TOKEN }}
+          file: cli/nmctl-darwin-amd64
+          tag: ${{ env.NETMAKER_VERSION }}
+          overwrite: true
+          prerelease: true
+          asset_name: nmctl-darwin-amd64
+      - name: Upload nmctl-darwin-arm64 to Release
+        continue-on-error: true
+        uses: svenstaro/upload-release-action@v2
+        with:
+          repo_token: ${{ secrets.GITHUB_TOKEN }}
+          file: cli/nmctl-darwin-arm64
+          tag: ${{ env.NETMAKER_VERSION }}
+          overwrite: true
+          prerelease: true
+          asset_name: nmctl-darwin-arm64
+      - name: Upload nmctl-windows-amd64 to Release
+        continue-on-error: true
+        uses: svenstaro/upload-release-action@v2
+        with:
+          repo_token: ${{ secrets.GITHUB_TOKEN }}
+          file: cli/nmctl-windows-amd64
+          tag: ${{ env.NETMAKER_VERSION }}
+          overwrite: true
+          prerelease: true
+          asset_name: nmctl-windows-amd64
   netclient-x86:
   netclient-x86:
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
     needs: version
     needs: version

+ 16 - 0
.github/workflows/test.yml

@@ -24,6 +24,22 @@ jobs:
          env CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build main.go
          env CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build main.go
          env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build main.go
          env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build main.go
          env CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build main.go
          env CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build main.go
+  nmctl:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v3
+      - name: Setup go
+        uses: actions/setup-go@v3
+        with:
+          go-version: 1.19
+      - name: Build
+        run: |
+          cd cli
+          GOOS=linux GOARCH=amd64 go build -o nmctl
+          GOOS=darwin GOARCH=amd64 go build -o nmctl
+          GOOS=darwin GOARCH=arm64 go build -o nmctl
+          GOOS=windows GOARCH=amd64 go build -o nmctl
   linux-gui:
   linux-gui:
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
     steps:
     steps:

+ 1 - 1
cli/cmd/root.go

@@ -20,7 +20,7 @@ import (
 
 
 // rootCmd represents the base command when called without any subcommands
 // rootCmd represents the base command when called without any subcommands
 var rootCmd = &cobra.Command{
 var rootCmd = &cobra.Command{
-	Use:   "netmaker",
+	Use:   "nmctl",
 	Short: "CLI for interacting with Netmaker Server",
 	Short: "CLI for interacting with Netmaker Server",
 	Long:  `CLI for interacting with Netmaker Server`,
 	Long:  `CLI for interacting with Netmaker Server`,
 	// Uncomment the following line if your bare application
 	// Uncomment the following line if your bare application