Skip to content

Commit

Permalink
Add goreleaser (#2)
Browse files Browse the repository at this point in the history
* Add goreleaser

* Change goreleaser main package

* Update readme

* Update goreleaser
  • Loading branch information
j178 authored Oct 8, 2022
1 parent 5f1bd05 commit ca44a6e
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 2 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Release

on:
push:
tags:
- '*'

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- run: git fetch --force --tags
- uses: actions/setup-go@v3
with:
go-version: '>=1.19.2'
cache: true
- uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
/cmd/twiyou/dev.go
.DS_Store
twiyou

dist/
36 changes: 36 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
before:
hooks:
- go mod tidy
builds:
- main: ./cmd/twiyou
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
flags:
- -v
- -trimpath
archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ twiyou(推油)是一款推特好友/推特数据监测工具。
运行起来需要部署3个组件:数据库,数据抓取工具,监控面板,目前这3个组件都有免费的白嫖资源,此外需要有推特开发者账号。

- 数据库我用的是TiDB Cloud DevTier (https://tidbcloud.com/ )的免费资源,理论上兼容MySQL协议的应该都行,不过我没试。
- 数据抓取工具可以`go build ./cmd/twiyou`编译出来,找台机器配置好环境变量定时运行程序就行(推荐5分钟运行一次)。也可以免费部署到Vercel (https://vercel.com/ ),不过我测了效果不算太好,没有服务器资源的话可以凑合用。
- 数据抓取工具可以从 [Release](https://github.com/disksing/twiyou/releases) 下载或者自行 `go build ./cmd/twiyou` 编译出来,找台机器配置好环境变量定时运行程序就行(推荐5分钟运行一次)。也可以免费部署到Vercel (https://vercel.com/ ),不过我测了效果不算太好,没有服务器资源的话可以凑合用。
- 监控面板用的是Grafana,Grafana Cloud (https://grafana.com/ )也是可以创建免费的账号,添加数据库数据源之后,把监控模板导入就行。

## 搭建自己的部署(详细攻略)
Expand All @@ -37,7 +37,7 @@ twiyou(推油)是一款推特好友/推特数据监测工具。

### 3. 部署数据抓取工具

下载地址:TBD(还没整release,先自己编译吧)
下载地址:https://github.com/disksing/twiyou/releases

然后配置好crontab和环境变量每5分钟运行一次就行,抓下来的数据都会写到数据库里面,本地不存数据。

Expand Down

0 comments on commit ca44a6e

Please sign in to comment.