Skip to content

Release SDK

Release SDK #1

Workflow file for this run

# Create an incremental tag on Github using SemVer https://semver.org: x.y.z
# A tag is a release version on pkg.go.dev, which is
# notified with the publishing go command.
name: Release SDK
on:
workflow_dispatch:
inputs:
choice:
type: choice
description: "Release types (x.y.patch / x.minor.z / major.y.z)"
options:
- patch
- minor
- major
jobs:
release-sdk:
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
name: Tag for release
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# download tags
fetch-depth: 0
- name: Last version
id: last-version
# last tag that starts with 'v', eg: v1.0.3 but outputs it as: 1.0.3
run: echo "LASTVERSION=$(git tag --list 'v*' | sort -V | tail -n1 | sed 's/v//')" >> $GITHUB_ENV
- name: Bump version
id: bump-version
uses: olegsu/semver-action@v1
with:
version: ${{ env.LASTVERSION }}
bump: ${{ inputs.choice }}
- name: Create tag as version for the package
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Actions"
git tag v${{ steps.bump-version.outputs.version }}
git push origin v${{ steps.bump-version.outputs.version }}
- name: Publish on pkg.go.dev
run: GOPROXY=proxy.golang.org go list -m github.com/sqlitecloud/sqlitecloud-go@v${{ steps.bump-version.outputs.version }}