From 58205c0ead07e95942f6203c7fa7865442e13d47 Mon Sep 17 00:00:00 2001 From: Soma Szelpal Date: Thu, 11 Jan 2024 13:28:25 +0100 Subject: [PATCH] update goreleaser manifest by replacing deprecated name_template (#184) * update goreleaser manifest by replacing deprecated * Removing old archives section leftover * Replace brew.tap with brew.repository * Modify brew.repository to be an object instad of an array how doc incorrectly says * Updated go@1.21 goreleaser@1.23 and added editorconfig --- .editorconfig | 25 ++++++++++ .github/workflows/bootstrap-templates.yml | 28 +++++------ .github/workflows/checks.yml | 14 +++--- .github/workflows/release.yml | 38 +++++++------- .gitignore | 3 +- .goreleaser.yml | 60 +++++++++++++---------- 6 files changed, 102 insertions(+), 66 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..71741b3 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,25 @@ +; https://editorconfig.org/ + +root = true + +[*] +charset = utf-8 +end_of_line = lf +trim_trailing_whitespace = true +insert_final_newline = true +indent_style = space +indent_size = 2 + +[{Makefile,go.mod,go.sum,*.go,.gitmodules}] +indent_style = tab +indent_size = 4 + +[*.md] +indent_size = 4 +trim_trailing_whitespace = false + +eclint_indent_style = unset + +[Dockerfile] +indent_size = 4 + diff --git a/.github/workflows/bootstrap-templates.yml b/.github/workflows/bootstrap-templates.yml index b55d18f..b16c989 100644 --- a/.github/workflows/bootstrap-templates.yml +++ b/.github/workflows/bootstrap-templates.yml @@ -1,23 +1,23 @@ name: Publish on: push: - tags: ['*'] - branches: ['bootstrapper'] + tags: ["*"] + branches: ["bootstrapper"] jobs: # The publish job will publish the bootstrap-templates directory to the correct S3 Bucket publish: runs-on: ubuntu-latest steps: - - uses: actions/checkout@master - - uses: jakejarvis/s3-sync-action@master - with: - args: --acl private --follow-symlinks - env: - # Credentials for this workflow are provisioned in the `terraform` directory - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_S3_BUCKET: truss-cli-global-config - AWS_REGION: us-east-2 - SOURCE_DIR: bootstrap-templates - DEST_DIR: bootstrap-templates \ No newline at end of file + - uses: actions/checkout@master + - uses: jakejarvis/s3-sync-action@master + with: + args: --acl private --follow-symlinks + env: + # Credentials for this workflow are provisioned in the `terraform` directory + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_S3_BUCKET: truss-cli-global-config + AWS_REGION: us-east-2 + SOURCE_DIR: bootstrap-templates + DEST_DIR: bootstrap-templates diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index ae70f57..a91bd80 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -10,12 +10,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.19 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: "1.21" - - name: Go test - run: go test ./cmd/ ./truss/ -timeout 15000ms + - name: Go test + run: go test ./cmd/ ./truss/ -timeout 15000ms diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ed11613..b6b2316 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,7 +5,7 @@ name: Release # Controls when the action will run. Triggers the workflow on push or pull request on: push: - tags: ['*'] + tags: ["*"] # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: @@ -16,24 +16,24 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 - # Unshallow required for goreleaser's changelog behavior - - name: Unshallow - run: git fetch --prune --unshallow + # Unshallow required for goreleaser's changelog behavior + - name: Unshallow + run: git fetch --prune --unshallow - # Go get'em! - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.19 + # Go get'em! + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: "1.21" - # Release the thing! - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v2 - with: - version: latest - args: release --rm-dist - env: - GITHUB_TOKEN: ${{ secrets.INSTRUCTURE_BRIDGE_GITHUB_BOT_REPO_RW }} + # Release the thing! + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: "1.23" + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.INSTRUCTURE_BRIDGE_GITHUB_BOT_REPO_RW }} diff --git a/.gitignore b/.gitignore index 19798e0..4b1d399 100644 --- a/.gitignore +++ b/.gitignore @@ -16,10 +16,11 @@ *.out # Dependency directories (remove the comment below to include it) -# vendor/ +vendor/ dist/ .envrc +.env # Secrets /secrets diff --git a/.goreleaser.yml b/.goreleaser.yml index 326e231..3c6cd7b 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -2,44 +2,54 @@ before: hooks: - go mod download - go generate ./... + builds: -- env: - - CGO_ENABLED=0 - ldflags: - - -X github.com/get-bridge/truss-cli/cmd.Version={{.Version}} - binary: truss - goos: - - darwin - - linux - goarch: - - amd64 - - arm64 + - env: + - CGO_ENABLED=0 + ldflags: + - -X github.com/get-bridge/truss-cli/cmd.Version={{.Version}} + binary: truss + goos: + - darwin + - linux + goarch: + - amd64 + - arm64 + archives: -- replacements: - darwin: Darwin - linux: Linux - windows: Windows - 386: i386 - amd64: x86_64 - arm64: arm64 + - format: tar.gz + # this name template makes the OS and Arch compatible with the results of `uname`. + name_template: >- + {{ .ProjectName }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} + # use zip for windows archives + format_overrides: + - goos: windows + format: zip + checksum: - name_template: 'checksums.txt' + name_template: "checksums.txt" + snapshot: name_template: "{{ .Tag }}-next" + changelog: sort: asc filters: exclude: - - '^docs:' - - '^test:' + - "^docs:" + - "^test:" brews: - - - name: truss-cli + - name: truss-cli description: CLI to help manage many k8s clusters homepage: https://github.com/get-bridge/truss-cli - tap: - owner: get-bridge + repository: name: homebrew-tap + owner: get-bridge folder: Formula dependencies: - name: kubectl