on main help sign in
ci: release and nightly jobs (#90)

* ci: release and nightly jobs plus several improvements * fix: diff * fix: aur * fix: schedule * fix: tmpl * fix: schedule

commit91bf008aa6d6f6d8086e77d053479380d7ce085b authorCarlos Alexandro Becker <caarlos0@users.noreply.github.com> dateTue 1 Jul 2025, 11:32 (1 year ago) parent6f2387c
4 files changed+101−50
.github/workflows/nightly.yml+12 .github/workflows/release.yml+14−32 .gitignore+3 .goreleaser.yml+72−18
.github/workflows/nightly.ymlnew file+12
@@ -0,0 +1,12 @@
1+name: nightly
2+
3+on:
4+ schedule:
5+ - cron: "0 0 * * *" # every day at midnight
6+ workflow_dispatch: # allows manual triggering
7+
8+jobs:
9+ nightly:
10+ uses: charmbracelet/meta/.github/workflows/nightly.yml@main
11+ secrets:
12+ goreleaser_key: ${{ secrets.GORELEASER_KEY }}
.github/workflows/release.yml+14−32
@@ -1,40 +1,22 @@
1−name: release
1+# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2+
3+name: goreleaser
24
35on:
4− workflow_dispatch:
56 push:
67 tags:
7− - "*"
8−
9−concurrency: ${{ github.workflow }}-${{ github.ref }}
8+ - v*.*.*
109
11−permissions:
12− contents: write
13− packages: write
10+concurrency:
11+ group: goreleaser
12+ cancel-in-progress: true
1413
1514jobs:
1615 goreleaser:
17− runs-on: ubuntu-latest
18− steps:
19− - uses: actions/checkout@v3
20− with:
21− fetch-depth: 0
22−
23− - run: git fetch --force --tags
24−
25− - uses: actions/setup-go@v5
26− with:
27− go-version: ">=1.23.2"
28− cache: true
29− cache-dependency-path: go.sum
30−
31− - run: go mod download
32−
33− - uses: goreleaser/goreleaser-action@v6
34− with:
35− distribution: goreleaser
36− version: latest
37− args: release --clean
38− env:
39− GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_TOKEN }}
40− AUR_KEY: ${{ secrets.AUR_KEY }}
16+ uses: charmbracelet/meta/.github/workflows/goreleaser.yml@main
17+ secrets:
18+ gh_pat: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
19+ goreleaser_key: ${{ secrets.GORELEASER_KEY }}
20+ fury_token: ${{ secrets.FURY_TOKEN }}
21+ nfpm_gpg_key: ${{ secrets.NFPM_GPG_KEY }}
22+ nfpm_passphrase: ${{ secrets.NFPM_PASSPHRASE }}
.gitignore+3
@@ -44,3 +44,6 @@ Thumbs.db
4444.crush/
4545
4646crush
47+
48+manpages/
49+completions/
.goreleaser.yml+72−18
@@ -4,6 +4,10 @@ version: 2
44
55project_name: crush
66
7+includes:
8+ - from_url:
9+ url: charmbracelet/meta/main/notarize.yaml
10+
711metadata:
812 mod_timestamp: "{{ .CommitTimestamp }}"
913 license: "MIT"
@@ -12,6 +16,29 @@ metadata:
1216 maintainers:
1317 - "kujtimiihoxha <kujtim@charm.sh>"
1418
19+nightly:
20+ publish_release: true
21+ keep_single_release: true
22+ version_template: "{{ incminor .Version }}-nightly"
23+
24+snapshot:
25+ version_template: "0.0.0-{{ .Timestamp }}"
26+
27+before:
28+ hooks:
29+ - go mod tidy
30+ - rm -rf completions
31+ - mkdir completions
32+ - rm -rf manpages
33+ - mkdir manpages
34+ - sh -c 'go run . completion bash >./completions/crush.bash'
35+ - sh -c 'go run . completion zsh >./completions/crush.zsh'
36+ - sh -c 'go run . completion fish >./completions/crush.fish'
37+ - sh -c 'go run . man | gzip -c >./manpages/crush.1.gz'
38+
39+gomod:
40+ proxy: true
41+
1542builds:
1643 - env:
1744 - CGO_ENABLED=0
@@ -24,19 +51,22 @@ builds:
2451 - arm64
2552 ldflags:
2653 - -s -w -X github.com/charmbracelet/crush/internal/version.Version={{.Version}}
27− main: ./main.go
2854
2955archives:
30− - formats: [tar.gz]
31− name_template: >-
32− crush-
33− {{- if eq .Os "darwin" }}mac-
34− {{- else if eq .Os "windows" }}windows-
35− {{- else if eq .Os "linux" }}linux-{{end}}
56+ - name_template: >-
57+ crush_
58+ {{- .Version }}_
59+ {{- title .Os }}_
3660 {{- if eq .Arch "amd64" }}x86_64
37− {{- else if eq .Arch "#86" }}i386
61+ {{- else if eq .Arch "386" }}i386
3862 {{- else }}{{ .Arch }}{{ end }}
39− {{- if .Arm }}v{{ .Arm }}{{ end }}
63+ {{- with .Arm}}v{{ . }}{{ end }}
64+ wrap_in_directory: true
65+ files:
66+ - README*
67+ - LICENSE*
68+ - manpages/*
69+ - completions/*
4070 format_overrides:
4171 - goos: windows
4272 formats: [zip]
@@ -44,18 +74,36 @@ archives:
4474checksum:
4575 name_template: "checksums.txt"
4676
47−snapshot:
48− version_template: "0.0.0-{{ .Timestamp }}"
49−
5077aurs:
5178 - private_key: "{{ .Env.AUR_KEY }}"
52− git_url: "ssh://aur@aur.archlinux.org/charmbracelet-bin.git"
79+ git_url: "ssh://aur@aur.archlinux.org/crush-bin.git"
5380 provides:
5481 - crush
5582 conflicts:
5683 - crush
5784 package: |-
58− install -Dm755 ./crush "${pkgdir}/usr/bin/crush"
85+ cd "${srcdir}/crush_${pkgver}_Linux_${CARCH}"
86+ # bin
87+ install -Dm755 "./crush" "${pkgdir}/usr/bin/crush"
88+ # license
89+ mkdir -p "${pkgdir}/usr/share/licenses/crush/"
90+ install -Dm644 ./LICENSE* "${pkgdir}/usr/share/licenses/crush/"
91+ # completions
92+ mkdir -p "${pkgdir}/usr/share/bash-completion/completions/"
93+ mkdir -p "${pkgdir}/usr/share/zsh/site-functions/"
94+ mkdir -p "${pkgdir}/usr/share/fish/vendor_completions.d/"
95+ install -Dm644 "./completions/crush.bash" "${pkgdir}/usr/share/bash-completion/completions/crush"
96+ install -Dm644 "./completions/crush.zsh" "${pkgdir}/usr/share/zsh/site-functions/_crush"
97+ install -Dm644 "./completions/crush.fish" "${pkgdir}/usr/share/fish/vendor_completions.d/crush.fish"
98+ # man pages
99+ install -Dm644 "./manpages/crush.1.gz" "${pkgdir}/usr/share/man/man1/crush.1.gz"
100+ # readme
101+ mkdir -pv "${pkgdir}/usr/share/doc/crush/"
102+ install -Dm644 README* "${pkgdir}/usr/share/doc/crush/"
103+
104+furies:
105+ - account: "{{ with .Env.FURY_TOKEN }}charmcli{{ else }}{{ end }}"
106+ secret_name: FURY_TOKEN
59107
60108homebrew_casks:
61109 - repository:
@@ -66,10 +114,16 @@ nfpms:
66114 - formats:
67115 - deb
68116 - rpm
69− file_name_template: >-
70− {{ .ProjectName }}-
71− {{- if eq .Os "darwin" }}mac
72− {{- else }}{{ .Os }}{{ end }}-{{ .Arch }}
117+ file_name_template: "{{ .ConventionalFileName }}"
118+ contents:
119+ - src: ./completions/crush.bash
120+ dst: /etc/bash_completion.d/crush
121+ - src: ./completions/crush.fish
122+ dst: /usr/share/fish/vendor_completions.d/crush.fish
123+ - src: ./completions/crush.zsh
124+ dst: /usr/share/zsh/site-functions/_crush
125+ - src: ./manpages/crush.1.gz
126+ dst: /usr/share/man/man1/crush.1.gz
73127
74128changelog:
75129 sort: asc