diff --git a/.github/workflows/buildandrelease.yml b/.github/workflows/buildandrelease.yml index 3c528677..cd2a212f 100644 --- a/.github/workflows/buildandrelease.yml +++ b/.github/workflows/buildandrelease.yml @@ -13,7 +13,7 @@ jobs: version: runs-on: ubuntu-latest outputs: - tag: ${{ steps.version.outputs.tag }} + tag: ${{ steps.version.outputs.package_version }} version: ${{ steps.version.outputs.version }} steps: - name: Get Version Number @@ -24,7 +24,7 @@ jobs: else NETMAKER_VERSION=$(curl -fsSL https://api.github.com/repos/gravitl/netmaker/tags | grep 'name' | head -1 | cut -d'"' -f4) fi - echo "NETMAKER_VERSION=${NETMAKER_VERSION}" >> $GITHUB_OUTPUT + echo "VERSION=${NETMAKER_VERSION}" >> $GITHUB_OUTPUT # remove everything but digits and . for package (deb, rpm, etc) versions PACKAGE_VERSION=$(echo ${NETMAKER_VERSION} | tr -cd '[:digit:].') echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> $GITHUB_OUTPUT @@ -34,11 +34,17 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + with: + ref: release_${{ needs.version.outputs.version }} + fetch-depth: 0 + - run: git fetch --force --tags - name: Setup go uses: actions/setup-go@v3 with: go-version: 1.19 - name: GoReleaser - uses: actions/goreleaser-action@v4 + uses: goreleaser/goreleaser-action@v4 with: args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 4f3cc809..69a3f8a1 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ data/ .idea/ netmaker.exe netmaker.code-workspace +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml index f7056c18..b40fd361 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -4,17 +4,16 @@ before: - go mod tidy builds: - main: ./ - id: netmaker + id: "netmaker" env: - CGO_ENABLED=1 ldflags: - -s -w targets: - linux_amd64 - no_unique_dist_dir: true - binary: '{{ .id }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}' - - main: ./cli - id: nmctl + binary: netmaker + - main: ./cli + id: "nmctl" env: - CGO_ENABLED=0 ldflags: @@ -26,10 +25,9 @@ builds: - darwin_arm64 - freebsd_amd64 - windows_amd64 - no_unique_dist_dir: true - binary: '{{ .id }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}' + binary: nmctl archives: - format: binary - name_template: '{{ .id}}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}' + name_template: '{{ .Binary }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}' changelog: - skip: true \ No newline at end of file + skip: true