chore: Update release-please-action organisation (#26) #20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: googleapis/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 "[email protected]" | |
git add version.go | |
git commit -m "chore: Configure the version number" | |
git push origin ${{ fromJSON(steps.release.outputs.pr).headBranchName }} |