diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 38e5bd8b..70f73456 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -267,17 +267,7 @@ jobs: version: v1.59.1 build: name: GoReleaser build - strategy: - matrix: - os: [ ubuntu-latest, macos-latest, windows-latest ] - include: - - os: ubuntu-latest - goos: linux - - os: macos-latest - goos: darwin - - os: windows-latest - goos: windows - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 @@ -287,34 +277,13 @@ jobs: uses: actions/setup-go@v4.1.0 with: go-version-file: go.mod - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: 16.18.1 - - name: Setup SHA variable - shell: bash - run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV - - name: Setup Cache - uses: actions/cache@v3.2.3 - with: - path: dist/${{ matrix.goos }} - key: ${{ matrix.goos }}-${{ env.sha_short }} - enableCrossOsArchive: true - - name: Install Dependencies - if: matrix.goos == 'linux' - shell: bash - run: | - sudo apt update - sudo apt install -y libwebkit2gtk-4.0-dev libgtk-3-dev - name: GoReleaser (Build) uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser-pro version: '~> v2' - args: release --clean --split --timeout 90m + args: build --clean --snapshot --timeout 90m env: - CGO_LDFLAGS: "${{ matrix.goos == 'darwin' && '-framework UniformTypeIdentifiers' || '' }}" - GOOS: ${{ matrix.GOOS }} GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITLAB_CLIENT_SECRET: ${{ secrets.GITLAB_CLIENT_SECRET }} diff --git a/.github/workflows/goreleaser-cd.yml b/.github/workflows/goreleaser-cd.yml index 737b02a4..8ffa9861 100644 --- a/.github/workflows/goreleaser-cd.yml +++ b/.github/workflows/goreleaser-cd.yml @@ -5,72 +5,9 @@ on: - 'v*.*.*' jobs: - # Build binaries with GoReleaser - prepare: - strategy: - matrix: - os: [ ubuntu-latest, macos-latest, windows-latest ] - include: - - os: ubuntu-latest - goos: linux - - os: macos-latest - goos: darwin - - os: windows-latest - goos: windows - runs-on: ${{ matrix.os }} - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Setup Go - uses: actions/setup-go@v4.1.0 - with: - go-version-file: go.mod - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: 16.18.1 - - name: Setup Cache - uses: actions/cache@v3.2.3 - with: - path: dist/${{ matrix.goos }} - key: ${{ matrix.goos }}-${{ github.ref_name }} - enableCrossOsArchive: true - - name: Install Dependencies - if: matrix.goos == 'linux' - shell: bash - run: | - sudo apt update - sudo apt install -y libwebkit2gtk-4.0-dev libgtk-3-dev - - name: Build web - shell: bash - run: make build-web - - name: Get Previous Tag - id: prev - uses: WyriHaximus/github-action-get-previous-tag@v1 - env: - INPUT_PREFIX: v - - name: GoReleaser (Build) - uses: goreleaser/goreleaser-action@v6 - with: - distribution: goreleaser-pro - version: '~> v2' - args: release --clean --split --timeout 90m - env: - CGO_LDFLAGS: "${{ matrix.goos == 'darwin' && '-framework UniformTypeIdentifiers' || '' }}" - GOOS: ${{ matrix.GOOS }} - GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITLAB_CLIENT_SECRET: ${{ secrets.GITLAB_CLIENT_SECRET }} - HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }} - GORELEASER_CURRENT_TAG: ${{ github.ref_name }} - GORELEASER_PREVIOUS_TAG: ${{ steps.release.outputs.prev }} - # Release binaries with GoReleaser release: runs-on: ubuntu-latest - needs: prepare env: DOCKER_CLI_EXPERIMENTAL: "enabled" permissions: @@ -84,26 +21,6 @@ jobs: - uses: actions/setup-go@v4.1.0 with: go-version-file: go.mod - - name: Copy Cache From Previous Job - shell: bash - run: | - echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV - - name: Restore Linux Cache - uses: actions/cache@v3.2.3 - with: - path: dist/linux - key: linux-${{ github.ref_name }} - - name: Restore Darwin Cache - uses: actions/cache@v3.2.3 - with: - path: dist/darwin - key: darwin-${{ github.ref_name }} - - name: Restore Windows Cache - uses: actions/cache@v3.2.3 - with: - path: dist/windows - key: windows-${{ github.ref_name }} - enableCrossOsArchive: true - name: Get Previous Tag id: prev uses: WyriHaximus/github-action-get-previous-tag@v1 @@ -113,11 +30,10 @@ jobs: uses: sigstore/cosign-installer@v3.6.0 - name: GoReleaser (Release) uses: goreleaser/goreleaser-action@v6 - if: steps.cache.outputs.cache-hit != 'true' # do not run if cache hit with: distribution: goreleaser-pro version: '~> v2' - args: continue --merge --timeout 90m + args: release --clean --timeout 90m env: GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml index a78044d4..c67b2525 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,10 +1,6 @@ # This is an example .goreleaser.yml file with some sensible defaults. # Make sure to check the documentation at https://goreleaser.com -# Requires a GoReleaser Pro to run -partial: - by: goos - version: 2 before: @@ -18,9 +14,7 @@ builds: - linux_amd64 - linux_arm64 - windows_amd64 - # TODO: Re-enable once fixed - # Ref: https://github.com/golang/go/issues/51019 - # - windows_arm64 + - windows_arm64 - darwin_amd64 - darwin_arm64 env: @@ -39,9 +33,7 @@ builds: - linux_amd64 - linux_arm64 - windows_amd64 - # TODO: Re-enable once fixed - # Ref: https://github.com/golang/go/issues/51019 - # - windows_arm64 + - windows_arm64 - darwin_amd64 - darwin_arm64 env: @@ -169,11 +161,69 @@ brews: test: | system "#{bin}/plural", "--help" - # # Packages your package depends on. - # dependencies: - # - name: helm - # type: recommended - # - name: kubectl - # type: recommended - # - name: terraform - # type: recommended + - name: plrlctl + ids: [plrlctl] + repository: + owner: pluralsh + name: homebrew-plrlctl + + # Optionally a branch can be provided. + # Defaults to the default repository branch. + branch: main + + # Optionally a token can be provided, if it differs from the token provided to GoReleaser + token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}" + + # Template for the url which is determined by the given Token (github, gitlab or gitea) + # + # Default depends on the client. + url_template: "https://github.com/pluralsh/plural-cli/releases/download/{{ .Tag }}/{{ .ArtifactName }}" + + # Allows you to set a custom download strategy. Note that you'll need + # to implement the strategy and add it to your tap repository. + # Example: https://docs.brew.sh/Formula-Cookbook#specifying-the-download-strategy-explicitly + # Default is empty. + download_strategy: CurlDownloadStrategy + + # Git author used to commit to the repository. + # Defaults are shown. + commit_author: + name: plural-bot + email: gh-bot@plural.sh + + # The project name and current git tag are used in the format string. + commit_msg_template: "Brew formula update for {{ .ProjectName }} version {{ .Tag }}" + + # Folder inside the repository to put the formula. + # Default is the root folder. + directory: Formula + + # Your app's homepage. + # Default is empty. + homepage: "https://docs.plural.sh" + + # Template of your app's description. + # Default is empty. + description: "CLI to manage and operate a fleet of clusters" + + # SPDX identifier of your app's license. + # Default is empty. + license: "MIT" + + # Setting this will prevent goreleaser to actually try to commit the updated + # formula - instead, the formula file will be stored on the dist folder only, + # leaving the responsibility of publishing it to the user. + # If set to auto, the release will not be uploaded to the homebrew tap + # in case there is an indicator for prerelease in the tag e.g. v1.0.0-rc1 + # Default is false. + skip_upload: "auto" + + # Custom block for brew. + # Can be used to specify alternate downloads for devel or head releases. + # Default is empty. + custom_block: | + head "https://github.com/pluralsh/plural-cli.git" + + test: | + system "#{bin}/plrlctl", "--help" + diff --git a/Makefile b/Makefile index 94bbb244..68041832 100644 --- a/Makefile +++ b/Makefile @@ -82,7 +82,7 @@ release: .PHONY: goreleaser goreleaser: - goreleaser release --clean --prepare --single-target --snapshot --verbose + goreleaser build --clean --snapshot .PHONY: setup setup: ## sets up your local env (for mac only)