Merge pull request #9 from StevanFreeborn/stevanfreeborn/chore/setup-automated-publishing

chore: add workflows for releasing
This commit is contained in:
Stevan Freeborn
2026-03-26 17:28:20 -05:00
committed by GitHub
3 changed files with 185 additions and 36 deletions
+35
View File
@@ -0,0 +1,35 @@
name: Publish
on:
push:
tags:
- "v*"
jobs:
publish:
name: Publish to Go Module Proxy
runs-on: ubuntu-latest
steps:
- name: Request module from proxy
run: |
MODULE="github.com/StevanFreeborn/onspring-api-sdk-go"
VERSION="${GITHUB_REF_NAME}"
PROXY_URL="https://proxy.golang.org/${MODULE}/@v/${VERSION}.info"
echo "Requesting: $PROXY_URL"
# Request the module version to warm the proxy cache
# Retry up to 3 times with a delay since the proxy may need time to fetch
for i in 1 2 3; do
STATUS=$(curl -s -o /dev/null -w "%{http_code}" "$PROXY_URL")
echo "Attempt $i: HTTP $STATUS"
if [ "$STATUS" = "200" ]; then
echo "Module $MODULE@$VERSION is available on the Go module proxy"
exit 0
fi
echo "Waiting 30 seconds before retry..."
sleep 30
done
echo "Warning: Module may not be immediately available on the proxy (HTTP $STATUS)"
echo "It will be indexed automatically when first requested by a user"
+105
View File
@@ -0,0 +1,105 @@
name: Version
on:
push:
branches:
- main
permissions:
contents: write
jobs:
version:
name: Version
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Determine version bump
id: bump
run: |
# Get the latest tag, default to v0.0.0 if none exists
LATEST_TAG=$(git tag -l 'v*' --sort=-v:refname | head -n 1)
if [ -z "$LATEST_TAG" ]; then
LATEST_TAG="v0.0.0"
COMMITS=$(git log --pretty=format:"%s" --no-merges)
else
COMMITS=$(git log "${LATEST_TAG}..HEAD" --pretty=format:"%s" --no-merges)
fi
echo "Latest tag: $LATEST_TAG"
echo "Commits since last tag:"
echo "$COMMITS"
# Parse current version
VERSION="${LATEST_TAG#v}"
MAJOR=$(echo "$VERSION" | cut -d. -f1)
MINOR=$(echo "$VERSION" | cut -d. -f2)
PATCH=$(echo "$VERSION" | cut -d. -f3)
# Determine bump type from conventional commits
BUMP="none"
if echo "$COMMITS" | grep -qiE "^[a-z]+(\(.+\))?!:|BREAKING CHANGE:"; then
BUMP="major"
elif echo "$COMMITS" | grep -qiE "^feat(\(.+\))?:"; then
BUMP="minor"
elif echo "$COMMITS" | grep -qiE "^(fix|perf|refactor|chore|docs|style|test|tests|build|ci)(\(.+\))?:"; then
BUMP="patch"
fi
echo "Bump type: $BUMP"
if [ "$BUMP" = "none" ]; then
echo "skip=true" >> "$GITHUB_OUTPUT"
exit 0
fi
# Calculate new version
case "$BUMP" in
major)
MAJOR=$((MAJOR + 1))
MINOR=0
PATCH=0
;;
minor)
MINOR=$((MINOR + 1))
PATCH=0
;;
patch)
PATCH=$((PATCH + 1))
;;
esac
NEW_TAG="v${MAJOR}.${MINOR}.${PATCH}"
echo "New version: $NEW_TAG"
echo "skip=false" >> "$GITHUB_OUTPUT"
echo "new_tag=$NEW_TAG" >> "$GITHUB_OUTPUT"
echo "previous_tag=$LATEST_TAG" >> "$GITHUB_OUTPUT"
- name: Generate release notes
if: steps.bump.outputs.skip == 'false'
id: notes
run: |
PREVIOUS_TAG="${{ steps.bump.outputs.previous_tag }}"
if [ "$PREVIOUS_TAG" = "v0.0.0" ]; then
NOTES=$(git log --pretty=format:"- %s" --no-merges)
else
NOTES=$(git log "${PREVIOUS_TAG}..HEAD" --pretty=format:"- %s" --no-merges)
fi
# Write notes to a file to preserve newlines
echo "$NOTES" > release_notes.txt
- name: Create tag and release
if: steps.bump.outputs.skip == 'false'
env:
GH_TOKEN: ${{ github.token }}
run: |
NEW_TAG="${{ steps.bump.outputs.new_tag }}"
git tag "$NEW_TAG"
git push origin "$NEW_TAG"
gh release create "$NEW_TAG" \
--title "$NEW_TAG" \
--notes-file release_notes.txt
+45 -36
View File
@@ -1,18 +1,22 @@
# Onspring API Go SDK
⚠️ Under Construction ⚠️
[![Pull Request](https://github.com/StevanFreeborn/onspring-api-sdk-go/actions/workflows/pull_request.yml/badge.svg)](https://github.com/StevanFreeborn/onspring-api-sdk-go/actions/workflows/pull_request.yml)
[![Version](https://github.com/StevanFreeborn/onspring-api-sdk-go/actions/workflows/version.yml/badge.svg)](https://github.com/StevanFreeborn/onspring-api-sdk-go/actions/workflows/version.yml)
[![Publish](https://github.com/StevanFreeborn/onspring-api-sdk-go/actions/workflows/publish.yml/badge.svg)](https://github.com/StevanFreeborn/onspring-api-sdk-go/actions/workflows/publish.yml)
[![Go Reference](https://pkg.go.dev/badge/github.com/StevanFreeborn/onspring-api-sdk-go.svg)](https://pkg.go.dev/github.com/StevanFreeborn/onspring-api-sdk-go)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE.md)
The Go SDK for the Onspring API is meant to simplify development in Go for Onspring customers who want to build integrations with their Onspring instance.
Note: This is an unofficial SDK for the Onspring API. It was not built in consultation with Onspring Technologies LLC or a member of their development team.
This SDK was developed independently using Onspring's existing C# SDK, the Onspring API's swagger page, and api documentation as the starting point with the intention of making development of integrations done in Javascript with an Onspring instance quicker and more convenient.
This SDK was developed independently using Onspring's existing C# SDK, the Onspring API's swagger page, and api documentation as the starting point with the intention of making development of integrations done in Go with an Onspring instance quicker and more convenient.
## Dependencies
### Go
Requires use of [Go](https://golang.org/dl/) version 1.23 or higher.
Requires use of [Go](https://golang.org/dl/) version 1.25 or higher.
## Installation
@@ -48,25 +52,25 @@ You can think of any API Key as another user in your Onspring instance and there
The most common way to use the SDK is to create a `Client` instance and call its methods to interact with the Onspring API. Here is an example of how to create a `Client` instance. You will need to provide your API key when creating the client. It is best practice to store your API key securely and not hard-code it in your source code.
```go
import "github.com/StevanFreeborn/onspring-api-sdk-go/onspring"
import "github.com/StevanFreeborn/onspring-api-sdk-go"
client := onspring.NewClient("your-api-key")
```
The `Client` instance can be further configured by providing optional configuration settings via the `ClientConfig` struct. For example, you can set a custom base URL for the Onspring API if needed:
The `Client` instance can be further configured by providing optional functional options. For example, you can set a custom base URL for the Onspring API if needed:
```go
import "github.com/StevanFreeborn/onspring-api-sdk-go/onspring"
import "github.com/StevanFreeborn/onspring-api-sdk-go"
client := onspring.NewClient(
"your-api-key",
onspring.WithBaseURL(customURL),
"your-api-key",
onspring.WithBaseURL(customURL),
)
```
### Full API Documentation
You may wish to refer to the full [Onspring API documentation](https://software.onspring.com/hubfs/Training/Admin%20Guide%20-%20v2%20API.pdf) when determining which values to pass as parameters to some of the `OnspringClient` methods. There is also a [swagger page](https://api.onspring.com/swagger/index.html) that you can use for making exploratory requests.
You may wish to refer to the full [Onspring API documentation](https://software.onspring.com/hubfs/Training/Admin%20Guide%20-%20v2%20API.pdf) when determining which values to pass as parameters to some of the `Client` methods. There is also a [swagger page](https://api.onspring.com/swagger/index.html) that you can use for making exploratory requests.
## Examples
@@ -76,8 +80,9 @@ You may wish to refer to the full [Onspring API documentation](https://software.
```go
import (
"context"
"fmt"
"github.com/StevanFreeborn/onspring-api-sdk-go/onspring"
"github.com/StevanFreeborn/onspring-api-sdk-go"
)
client := onspring.NewClient("your-api-key")
@@ -95,8 +100,9 @@ if err == nil {
```go
import (
"context"
"fmt"
"github.com/StevanFreeborn/onspring-api-sdk-go/onspring"
"github.com/StevanFreeborn/onspring-api-sdk-go"
)
client := onspring.NewClient("your-api-key")
@@ -116,8 +122,9 @@ if err != nil {
```go
import (
"context"
"fmt"
"github.com/StevanFreeborn/onspring-api-sdk-go/onspring"
"github.com/StevanFreeborn/onspring-api-sdk-go"
)
client := onspring.NewClient("your-api-key")
@@ -135,8 +142,9 @@ if err != nil {
```go
import (
"context"
"fmt"
"github.com/StevanFreeborn/onspring-api-sdk-go/onspring"
"github.com/StevanFreeborn/onspring-api-sdk-go"
)
client := onspring.NewClient("your-api-key")
@@ -154,8 +162,9 @@ for app, err := range client.Apps.ListAll(context.TODO()) {
```go
import (
"context"
"fmt"
"github.com/StevanFreeborn/onspring-api-sdk-go/onspring"
"github.com/StevanFreeborn/onspring-api-sdk-go"
)
client := onspring.NewClient("your-api-key")
@@ -177,7 +186,7 @@ if err != nil {
import (
"context"
"fmt"
"github.com/StevanFreeborn/onspring-api-sdk-go/onspring"
"github.com/StevanFreeborn/onspring-api-sdk-go"
)
client := onspring.NewClient("your-api-key")
@@ -199,7 +208,7 @@ if err != nil {
import (
"context"
"fmt"
"github.com/StevanFreeborn/onspring-api-sdk-go/onspring"
"github.com/StevanFreeborn/onspring-api-sdk-go"
)
client := onspring.NewClient("your-api-key")
@@ -219,7 +228,7 @@ if err != nil {
import (
"context"
"fmt"
"github.com/StevanFreeborn/onspring-api-sdk-go/onspring"
"github.com/StevanFreeborn/onspring-api-sdk-go"
)
client := onspring.NewClient("your-api-key")
@@ -239,7 +248,7 @@ for field, err := range client.Fields.ListAll(context.TODO(), 1) {
import (
"context"
"fmt"
"github.com/StevanFreeborn/onspring-api-sdk-go/onspring"
"github.com/StevanFreeborn/onspring-api-sdk-go"
)
client := onspring.NewClient("your-api-key")
@@ -263,7 +272,7 @@ Create a new list item or update an existing one. To create a new item, omit the
import (
"context"
"fmt"
"github.com/StevanFreeborn/onspring-api-sdk-go/onspring"
"github.com/StevanFreeborn/onspring-api-sdk-go"
)
client := onspring.NewClient("your-api-key")
@@ -292,7 +301,7 @@ if err != nil {
import (
"context"
"fmt"
"github.com/StevanFreeborn/onspring-api-sdk-go/onspring"
"github.com/StevanFreeborn/onspring-api-sdk-go"
)
client := onspring.NewClient("your-api-key")
@@ -314,7 +323,7 @@ if err != nil {
import (
"context"
"fmt"
"github.com/StevanFreeborn/onspring-api-sdk-go/onspring"
"github.com/StevanFreeborn/onspring-api-sdk-go"
)
client := onspring.NewClient("your-api-key")
@@ -348,7 +357,7 @@ report, err := client.Reports.Get(
import (
"context"
"fmt"
"github.com/StevanFreeborn/onspring-api-sdk-go/onspring"
"github.com/StevanFreeborn/onspring-api-sdk-go"
)
client := onspring.NewClient("your-api-key")
@@ -368,7 +377,7 @@ if err != nil {
import (
"context"
"fmt"
"github.com/StevanFreeborn/onspring-api-sdk-go/onspring"
"github.com/StevanFreeborn/onspring-api-sdk-go"
)
client := onspring.NewClient("your-api-key")
@@ -390,7 +399,7 @@ for report, err := range client.Reports.ListAll(context.TODO(), 1) {
import (
"context"
"fmt"
"github.com/StevanFreeborn/onspring-api-sdk-go/onspring"
"github.com/StevanFreeborn/onspring-api-sdk-go"
)
client := onspring.NewClient("your-api-key")
@@ -412,7 +421,7 @@ import (
"context"
"fmt"
"os"
"github.com/StevanFreeborn/onspring-api-sdk-go/onspring"
"github.com/StevanFreeborn/onspring-api-sdk-go"
)
client := onspring.NewClient("your-api-key")
@@ -434,7 +443,7 @@ if err != nil {
import (
"context"
"fmt"
"github.com/StevanFreeborn/onspring-api-sdk-go/onspring"
"github.com/StevanFreeborn/onspring-api-sdk-go"
)
client := onspring.NewClient("your-api-key")
@@ -455,7 +464,7 @@ import (
"context"
"fmt"
"os"
"github.com/StevanFreeborn/onspring-api-sdk-go/onspring"
"github.com/StevanFreeborn/onspring-api-sdk-go"
)
client := onspring.NewClient("your-api-key")
@@ -489,7 +498,7 @@ if err != nil {
import (
"context"
"fmt"
"github.com/StevanFreeborn/onspring-api-sdk-go/onspring"
"github.com/StevanFreeborn/onspring-api-sdk-go"
)
client := onspring.NewClient("your-api-key")
@@ -521,7 +530,7 @@ record, err := client.Records.Get(
import (
"context"
"fmt"
"github.com/StevanFreeborn/onspring-api-sdk-go/onspring"
"github.com/StevanFreeborn/onspring-api-sdk-go"
)
client := onspring.NewClient("your-api-key")
@@ -552,7 +561,7 @@ page, err := client.Records.List(
import (
"context"
"fmt"
"github.com/StevanFreeborn/onspring-api-sdk-go/onspring"
"github.com/StevanFreeborn/onspring-api-sdk-go"
)
client := onspring.NewClient("your-api-key")
@@ -572,7 +581,7 @@ for record, err := range client.Records.ListAll(context.TODO(), 1) {
import (
"context"
"fmt"
"github.com/StevanFreeborn/onspring-api-sdk-go/onspring"
"github.com/StevanFreeborn/onspring-api-sdk-go"
)
client := onspring.NewClient("your-api-key")
@@ -598,7 +607,7 @@ if err != nil {
import (
"context"
"fmt"
"github.com/StevanFreeborn/onspring-api-sdk-go/onspring"
"github.com/StevanFreeborn/onspring-api-sdk-go"
)
client := onspring.NewClient("your-api-key")
@@ -621,7 +630,7 @@ if err != nil {
import (
"context"
"fmt"
"github.com/StevanFreeborn/onspring-api-sdk-go/onspring"
"github.com/StevanFreeborn/onspring-api-sdk-go"
)
client := onspring.NewClient("your-api-key")
@@ -644,7 +653,7 @@ for record, err := range client.Records.QueryAll(context.TODO(), onspring.QueryR
import (
"context"
"fmt"
"github.com/StevanFreeborn/onspring-api-sdk-go/onspring"
"github.com/StevanFreeborn/onspring-api-sdk-go"
)
client := onspring.NewClient("your-api-key")
@@ -667,7 +676,7 @@ if err != nil {
import (
"context"
"fmt"
"github.com/StevanFreeborn/onspring-api-sdk-go/onspring"
"github.com/StevanFreeborn/onspring-api-sdk-go"
)
client := onspring.NewClient("your-api-key")
@@ -687,7 +696,7 @@ if err != nil {
import (
"context"
"fmt"
"github.com/StevanFreeborn/onspring-api-sdk-go/onspring"
"github.com/StevanFreeborn/onspring-api-sdk-go"
)
client := onspring.NewClient("your-api-key")