diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..fa4b4b117 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +--- +name: Release +on: + push: + tags: + - "v*" +jobs: + goreleaser: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.17.x + - name: Setup Snapcraft + run: | + sudo snap install snapcraft --classic + snapcraft login --with - <<<"${SNAP_TOKEN}" + env: + SNAP_TOKEN: ${{ secrets.SNAP_LOGIN }} + SNAPCRAFT_BUILD_ENVIRONMENT: host + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }} + diff --git a/.gitignore b/.gitignore index fa2738b9f..1140f652b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ _output/ /shp /shp-* /bin/* +dist/ diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 000000000..fde445b12 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,59 @@ +before: + hooks: + - go generate ./... +builds: +- env: + - CGO_ENABLED=0 + goos: + - linux + - darwin + goarch: + - amd64 + - arm64 + main: ./cmd/shp/main.go +archives: +- replacements: + darwin: Darwin + linux: Linux + amd64: x86_64 +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ incpatch .Version }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' +brews: +- tap: + name: shipwright-tap + owner: shipwright + token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}" + url_template: "https://github.com/shipwright-io/cli/releases/download/{{ .Tag }}/{{ .ArtifactName }}" + download_strategy: CurlDownloadStrategy + commit_author: + name: GoReleaser Bot + email: goreleaser@carlosbecker.com + folder: HomebrewFormula + homepage: "https://github.com/shipwright-io/cli" + description: "shp is the command line for shipwright" + license: "MIT" + skip_upload: false + test: | + system "#{bin}/shipwright-cli help" + +snapcrafts: +- id: shipwright-cli + publish: true + summary: "shp is the command line for shipwright" + description: "shp is the command line for shipwright" + grade: stable + confinement: strict + license: MIT + base: bare + apps: + shipwright-cli: + plugs: ["ci", "build"] +