-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (70 loc) · 2.13 KB
/
ci.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
name: CI
on:
push:
branches:
- main
paths-ignore:
- .editorconfig
- .gitignore
- CHANGELOG.md
- LICENSE.md
- README.md
jobs:
verify:
name: Verify
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Check formatting
run: test -z "$(go fmt ./...)"
- name: Lint source code
uses: golangci/golangci-lint-action@v4
with:
version: latest
- name: Look for suspicious constructs
run: test -z "$(go vet ./...)"
- name: Run tests
run: go test -cover -v ./...
release:
name: Release?
needs: [ verify ]
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare a release
id: release
uses: google-github-actions/release-please-action@v4
with:
config-file: .github/release-config.json
manifest-file: .github/release-manifest.json
token: ${{ secrets.GITHUB_TOKEN }}
- name: Update the version number
if: steps.release.outputs.prs_created && steps.release.outputs.pr != null
run: |
git config pull.rebase true
git checkout ${{ fromJSON(steps.release.outputs.pr).headBranchName }}
git pull origin ${{ fromJSON(steps.release.outputs.pr).headBranchName }}
version=$(jq -r '."."' .github/release-manifest.json)
version=${version#v}
cat << EOF > version.go
package anthropic
// semanticVersion does not need to be updated manually.
// It is automatically updated by the release process.
const semanticVersion = "$version"
EOF
git config --local user.name "David Letterman"
git config --local user.email "48985810+david-letterman@users.noreply.github.com"
git add version.go
git commit -m "chore: Configure the version number"
git push origin ${{ fromJSON(steps.release.outputs.pr).headBranchName }}