From 188118fe1a81fcfdab35f88cd969614e5dc6f940 Mon Sep 17 00:00:00 2001 From: Zhenzhen Zhao Date: Wed, 31 Aug 2022 22:59:22 +0800 Subject: [PATCH] =?UTF-8?q?Support=20install=20double-entry-generator=20vi?= =?UTF-8?q?a=20homebrew=20=F0=9F=8E=89=20=20=20(#64)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: support homebrew :tada: add `brews` in `goreleaser.yml` chore: ignore building `windows/arm64` use gh app to generate org-scoped access token Signed-off-by: Triple-Z * doc: add homebrew installation Signed-off-by: Triple-Z Signed-off-by: Triple-Z --- .github/workflows/goreleaser.yml | 15 +++++++++-- .goreleaser.yml | 46 +++++++++++++++++++++++++++++--- README.md | 13 ++++++++- 3 files changed, 68 insertions(+), 6 deletions(-) diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index dcb98a8..873bc92 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -11,8 +11,18 @@ permissions: jobs: goreleaser: + permissions: + id-token: write + contents: write runs-on: ubuntu-latest steps: + - name: Create GitHub App Installation Token + uses: jnwng/github-app-installation-token-action@v2 + id: installationToken + with: + appId: 233273 + installationId: 28742230 + privateKey: ${{ secrets.GH_APP_PRIVATE_KEY }} - name: Checkout uses: actions/checkout@v2 @@ -25,9 +35,10 @@ jobs: go-version: 1.16 - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v2 + uses: goreleaser/goreleaser-action@v3 with: + distribution: goreleaser version: latest args: release --rm-dist env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ steps.installationToken.outputs.token }} diff --git a/.goreleaser.yml b/.goreleaser.yml index f6d9e04..2f4bcb7 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -4,17 +4,34 @@ before: hooks: - go mod tidy builds: - - env: + - + id: double-entry-generator + env: - CGO_ENABLED=0 binary: double-entry-generator goos: - linux - windows - darwin + goarch: + - 386 + - amd64 + - arm64 + # List of combinations of GOOS + GOARCH + GOARM to ignore. + ignore: + - goos: darwin + goarch: 386 + - goos: windows + goarch: arm64 ldflags: - - -s -w -X github.com/deb-sig/double-entry-generator/pkg/version.VERSION={{.Version}} -X github.com/deb-sig/double-entry-generator/pkg/version.REPOROOT=github.com/deb-sig/double-entry-generator -X github.com/deb-sig/double-entry-generator/pkg/version.COMMIT={{.ShortCommit}} + - -s -w + - -X github.com/deb-sig/double-entry-generator/pkg/version.VERSION={{.Version}} + - -X github.com/deb-sig/double-entry-generator/pkg/version.REPOROOT=github.com/deb-sig/double-entry-generator + - -X github.com/deb-sig/double-entry-generator/pkg/version.COMMIT={{.ShortCommit}} archives: - - replacements: + - + id: double-entry-generator + replacements: darwin: Darwin linux: Linux windows: Windows @@ -30,3 +47,26 @@ changelog: exclude: - '^docs:' - '^test:' +universal_binaries: + - replace: true +brews: + - + name: double-entry-generator + ids: + - double-entry-generator + tap: + owner: deb-sig + name: homebrew-tap + branch: main + commit_author: + name: TripleZ + email: me@triplez.cn + folder: Formula + homepage: https://github.com/deb-sig/double-entry-generator + description: Rule-based double-entry bookkeeping importer (from Alipay/WeChat/Huobi to Beancount). + license: Apache-2.0 + # skip_upload: auto + caveats: | + Please run `double-entry-generator help` for more help. + test: | + system "#{bin}/double-entry-generator version" diff --git a/README.md b/README.md index cf6b33b..919daf6 100644 --- a/README.md +++ b/README.md @@ -24,9 +24,20 @@ ## 安装 +### Homebrew + +使用 Homebrew 安装: + +```bash +$ brew install deb-sig/tap/double-entry-generator +``` + +### 二进制安装 + 在 [GitHub Release](https://github.com/deb-sig/double-entry-generator/releases) 页面中下载相应架构的二进制文件到本地即可。 -源码安装: +### 源码安装 + ```bash go get -u github.com/deb-sig/double-entry-generator ```