-
Notifications
You must be signed in to change notification settings - Fork 14
127 lines (120 loc) · 3.65 KB
/
release.yaml
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
name: release
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
jobs:
build-linux-binary:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- run: git fetch --force --tags
- uses: actions/setup-go@v4
with:
go-version: '1.21'
cache-dependency-path: server/go.sum
cache: true
- uses: goreleaser/goreleaser-action@v6
with:
# either 'goreleaser' (default) or 'goreleaser-pro':
distribution: goreleaser
workdir: ./server
version: '~> v2'
args: release --skip publish --config .goreleaser-linux.yaml
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
- name: Upload
uses: actions/upload-artifact@v3
with:
name: milvus-cdc-linux
path: |
server/dist/milvus-cdc*
server/dist/checksums.txt
build-darwin-binary:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: '1.21'
cache-dependency-path: server/go.sum
cache: true
- uses: goreleaser/goreleaser-action@v6
with:
# either 'goreleaser' (default) or 'goreleaser-pro':
distribution: goreleaser
workdir: ./server
version: '~> v2'
args: release --skip publish --config .goreleaser-darwin.yaml
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
- name: Upload
uses: actions/upload-artifact@v3
with:
name: milvus-cdc-darwin
path: |
server/dist/milvus-cdc*
server/dist/checksums.txt
merge-and-release:
needs: [build-linux-binary, build-darwin-binary]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- run: git fetch --force --tags
- uses: actions/setup-go@v4
with:
go-version: '1.21'
cache-dependency-path: server/go.sum
cache: true
- name: Make directories
run: |
mkdir -p ./milvus-cdc-build/linux
mkdir -p ./milvus-cdc-build/darwin
- name: Download linux binaries
uses: actions/download-artifact@v3
with:
name: milvus-cdc-linux
path: ./milvus-cdc-build/linux
- name: Download darwin binaries
uses: actions/download-artifact@v3
with:
name: milvus-cdc-darwin
path: ./milvus-cdc-build/darwin
- name: Merge checksum file
run: |
cd ./milvus-cdc-build
cat ./darwin/checksums.txt >> checksums.txt
cat ./linux/checksums.txt >> checksums.txt
rm ./darwin/checksums.txt
rm ./linux/checksums.txt
- name: Check git status
run: |
tree
git status
- name: Release
uses: goreleaser/goreleaser-action@v6
with:
version: '~> v2'
args: release --clean --config .goreleaser.yaml
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
- name: Docker Login
uses: docker/login-action@v2
with:
username: milvusdb
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push docker image
run: |
tag=$(git tag --sort=-version:refname | head -1)
docker build --build-arg GIT_COMMIT_ARG=$(git rev-parse --short HEAD) -t milvusdb/milvus-cdc:$tag -t milvusdb/milvus-cdc:latest .
docker push milvusdb/milvus-cdc:$tag
docker push milvusdb/milvus-cdc:latest