Skip to content

chore: Make version updates less fiddly (#25) #19

chore: Make version updates less fiddly (#25)

chore: Make version updates less fiddly (#25) #19

Workflow file for this run

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 }}