-
Notifications
You must be signed in to change notification settings - Fork 53
89 lines (86 loc) · 2.85 KB
/
go_release.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
name: Go Release
on:
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
build:
name: Release
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- 'ubuntu-latest'
go-version: [ '1.21.x' ]
python-version: [ '3.11' ]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{matrix.python-version}}
- name: Display version
run: |
go version
python --version
- name: Install latest version of Poetry
if: steps.cache-poetry.outputs.cache-hit != 'true'
run: |
pip install poetry
- name: Add Poetry to $PATH
run: |
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
- name: Get Poetry version
run: poetry --version
- name: Install deps
if: steps.cache-deps.cache-hit != 'true'
run: |
make install
- name: Run test
run: |
make mock
make -C go test
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
working-directory: go/qianfan
- name: Check version
id: check-version
run: |
VERSION=$(cat go/qianfan/version.go|grep 'const Version ='|sed -r "s/.*\"v(.*)\"/\1/g")
echo $VERSION
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: get pr collection # 获取tag之间的pr内容,输出为md文件的路径
id: get-pr
working-directory: ./python
env:
REPO: ${{ github.repository }}
QF_GITHUB_TOKEN: ${{ secrets.QF_GITHUB_TOKEN }}
NEW_TAG: ${{ format('go/qianfan/v{0}', steps.check-version.outputs.version) }}
run: |
bash ./scripts/release_note.sh go
echo body_path=$(realpath ./release_note.md) >> $GITHUB_OUTPUT
- name: Create Release
uses: ncipollo/release-action@v1
with:
name: ${{ format('Go v{0}', steps.check-version.outputs.version) }}
token: ${{ secrets.QF_GITHUB_TOKEN }}
draft: false
bodyFile: ${{ steps.get-pr.outputs.body_path }} # 引入上文生成的release_note.md作为内容
generateReleaseNotes: false
tag: ${{ format('go/qianfan/v{0}', steps.check-version.outputs.version) }}
prerelease: ${{ contains(steps.check-version.outputs.version, 'rc') }}
commit: main
- name: Update Go module index
env:
GOPROXY: proxy.golang.org
VERSION: ${{ steps.check-version.outputs.version }}
run: |
go list -m github.com/baidubce/bce-qianfan-sdk/go/qianfan@v$VERSION