Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 4 additions & 17 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,11 @@ If everything seems OK, you can proceed to do the following:
1. Update the version string in `internal/version/version.go` and run `make gen`.
2. Add details in `CHANGELOG.md` on what changed.
3. Create a PR with the subject `chore: update version to X.Y.Z`
4. Once the above PR is approved and merged, create a new git tag `vX.Y.Z` pointing to the commit of the above PR merged to `main`:
4. Once the above PR is approved and merged, update your local branch and run `release.sh`.
If the script reports errors, fix them before continuing.
If there are no issues, it will output the Github tag URL.

```shell
# Ensure your local copy is up to date with main. Be sure to stash any changes first.
git fetch origin
git reset --hard origin/main
# Fetch existing tags first!
git fetch --tags
git tag -a vX.Y.Z -m 'vX.Y.Z'
```

5. Push the tag:

```shell
git push origin tag vX.Y.Z
```

6. Visit `https://github.com/coder/agentapi/releases/tag/vX.Y.Z` and "Create release from tag".
5. Visit `https://github.com/coder/agentapi/releases/tag/vX.Y.Z` and "Create release from tag".

- Select the tag you pushed previously.
- Select the previous tag and "Generate release notes". Amend as required.
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

//go:generate sh -c "go run main.go server --print-openapi dummy > openapi.json"
//go:generate ./set_version.sh
//go:generate ./version.sh
import "github.com/coder/agentapi/cmd"

func main() {
Expand Down
38 changes: 38 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
set -euo pipefail

GIT_BRANCH="${GIT_BRANCH:-main}"
echo "GIT_BRANCH=${GIT_BRANCH}"
LOCAL_HEAD=$(git rev-parse --short "${GIT_BRANCH}")
echo "LOCAL_HEAD=${LOCAL_HEAD}"
REMOTE_HEAD=$(git rev-parse --short origin/"${GIT_BRANCH}")
echo "REMOTE_HEAD=${REMOTE_HEAD}"
if [[ "${LOCAL_HEAD}" != "${REMOTE_HEAD}" ]]; then
echo "Please ensure your local branch is up to date before continuing."
exit 1
fi

VERSION=""
if ! VERSION=$(./version.sh); then
echo "version.sh exited with a non-zero status code. Fix this before continuing."
exit 1
elif [[ -z "${VERSION}" ]]; then
echo "Version reported by version.sh was empty. Fix this before continuing."
exit 1
fi

echo "VERSION=${VERSION}"
./check_unstaged.sh || exit 1

if ! grep -q "## v${VERSION}" CHANGELOG.md; then
echo "Please update CHANGELOG.md with details for ${VERSION} before continuing."
exit 1
fi

TAG_NAME="v${VERSION}"
echo "TAG_NAME=${TAG_NAME}"
git fetch --tags
git tag -a "${TAG_NAME}" -m "${TAG_NAME}"
git push origin tag "${TAG_NAME}"

echo "https://github.com/coder/agentapi/releases/new?tag=${TAG_NAME}"
2 changes: 2 additions & 0 deletions set_version.sh → version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ version=$(go run main.go --version | awk '{print $3}')

jq --arg version "${version}" '.info.version = $version' openapi.json > openapi.json.tmp && mv openapi.json.tmp openapi.json
jq --arg version "${version}" '.version = $version' chat/package.json > chat/package.json.tmp && mv chat/package.json.tmp chat/package.json

echo -n "${version}"