-
-
Notifications
You must be signed in to change notification settings - Fork 53
110 lines (91 loc) · 3.16 KB
/
go.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Go
on:
pull_request:
push:
jobs:
build:
runs-on: ubuntu-latest
container: ghcr.io/carapace-sh/go:1.23.1
steps:
- name: shallow clone
uses: actions/checkout@v4
if: "!startsWith(github.ref, 'refs/tags/')"
- name: deep clone
uses: actions/checkout@v4
if: startsWith(github.ref, 'refs/tags/')
with:
fetch-depth: 0
- name: fix git safe.directory
run: git config --global --add safe.directory '*'
- name: Generate
run: go generate ./cmd/...
- name: Build
run: ls cmd/ | xargs -I'{}' sh -c "cd ./cmd/{} && go build -v ."
- uses: actions/upload-artifact@v4
with:
name: carapace
path: ./cmd/carapace/carapace
retention-days: 1
- name: Test
run: go test -v ./cmd/...
- name: "Check formatting"
run: '[ "$(gofmt -d -s . | tee -a /dev/stderr)" = "" ]'
- name: "staticcheck"
run: go install honnef.co/go/tools/cmd/staticcheck@latest && staticcheck ./...
- name: "carapace-lint"
run: go run ./cmd/carapace-lint completers/*/cmd/*.go
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
if: startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AUR_KEY: ${{ secrets.AUR_KEY }}
FURY_TOKEN: ${{ secrets.FURY_TOKEN }}
GORELEASER_GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
doc:
runs-on: ubuntu-latest
container: ghcr.io/carapace-sh/carapace
needs: build
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: carapace
path: ./cmd/carapace
- name: "build docs"
run: |
chmod +x cmd/carapace/carapace
sed -i 's/\[output.linkcheck\]/#[output.linkcheck]/' docs/book.toml
sh .github/completers.sh > docs/src/completers.md
sh .github/conditions.sh > docs/src/variable/conditions.md
sh .github/macros.sh > docs/src/spec/macros.md
mdbook build docs
sh .github/badge.sh > docs/book/badge.svg
sh .github/macros-badge.sh > docs/book/macros-badge.svg
- name: "push gh-pages"
if: github.ref == 'refs/heads/master'
run: |
cd docs/book/
git init
git config user.name rsteube
git config user.email [email protected]
git add .
git commit -m "initial commit [ci skip]"
git push --force https://rsteube:${GITHUB_TOKEN}@github.com/carapace-sh/carapace-bin.git master:gh-pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
winget:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: build
steps:
- uses: vedantmgoyal2009/winget-releaser@v2
with:
identifier: rsteube.Carapace
max-versions-to-keep: 5
installers-regex: '_windows_amd64\.zip$'
fork-user: rsteube-bot
token: ${{ secrets.WINGET_TOKEN }}