-
-
Notifications
You must be signed in to change notification settings - Fork 43
153 lines (133 loc) · 4.38 KB
/
tag.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: Test/Build/Push (tag)
on:
push:
tags:
- "*"
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
go_version: ["1.22"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go_version }}
- name: Install go dependencies & run tests
shell: script -q -e -c "bash {0}"
run: |
export TERM=xterm
go get -t -v ./...
go test -v -cover -tags=ci ./...
docker-build-push:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v3
- uses: azure/docker-login@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up docker buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
with:
buildx-version: latest
qemu-version: latest
- name: Docker buildx available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Get the version
id: get_version
run: echo ::set-output name=TAG_NAME::${GITHUB_REF/refs\/tags\//}
- name: Run docker buildx build
run: |
docker buildx build \
--build-arg Version=${{ github.ref }} \
--platform linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 \
--output=type=registry \
--tag ekofr/monday:${{ steps.get_version.outputs.TAG_NAME }} \
.
release:
runs-on: ubuntu-latest
needs: test
steps:
- name: Create release
id: create
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false
outputs:
upload_url: ${{ steps.create.outputs.upload_url }}
update-homebrew:
runs-on: ubuntu-latest
needs: release
steps:
- name: Update monday Homebrew formula
uses: Justintime50/homebrew-releaser@v1
with:
commit_owner: eko
commit_email: [email protected]
homebrew_owner: eko
homebrew_tap: homebrew-tap
formula_folder: Formula
github_token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
install: |
ENV["GOPATH"] = buildpath
dir = buildpath/"src/github.com/eko/monday"
dir.install buildpath.children - [buildpath/".brew_home"]
cd dir do
system "make build-binary"
bin.install "monday"
output = Utils.popen_read("#{bin}/monday completion bash")
(bash_completion/"monday").write output
output = Utils.popen_read("#{bin}/monday completion zsh")
(zsh_completion/"_monday").write output
prefix.install_metafiles
end
test: 'assert_match("Monday - version", shell_output("#{bin}/monday version"))'
upload-binaries:
needs: release
strategy:
matrix:
include:
- os: ubuntu-latest
goos: linux
goarch: 386
- os: ubuntu-latest
goos: linux
goarch: amd64
- os: ubuntu-latest
goos: linux
goarch: arm
- os: macos-latest
goos: darwin
goarch: amd64
- os: macos-latest
goos: darwin
goarch: arm64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "1.22"
- name: Download go dependencies
run: go get -t -v ./...
- name: Create release
run: GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags "-s -w -X main.Version=${{ github.ref }}" -o monday-${{ matrix.goos }}-${{ matrix.goarch }} ./cmd
- name: Upload release assets
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./monday-${{ matrix.goos }}-${{ matrix.goarch }}
asset_name: monday-${{ matrix.goos }}-${{ matrix.goarch }}
asset_content_type: application/octet-stream