Skip to content

feat(go): Unions include runtime validation (#5403) #18

feat(go): Unions include runtime validation (#5403)

feat(go): Unions include runtime validation (#5403) #18

# Generators are registered within seed.yml, once their tests are passing
name: publish-and-register-go-sdk
on:
push:
branches:
- main
paths:
- "generators/go/sdk/versions.yml"
workflow_dispatch:
inputs:
version:
description: "The version of the generator to publish."
required: true
type: string
env:
DOCKER_BUILDKIT: 1
jobs:
publish-changed-generators:
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repo at current ref
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 2
- name: Install
uses: ./.github/actions/install
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Run publish
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
DOCKER_USERNAME: fernapi
DOCKER_PASSWORD: ${{ secrets.FERN_API_DOCKERHUB_PASSWORD }}
run: |
VERSIONS_FILE="generators/go/sdk/versions.yml"
git show HEAD~1:${VERSIONS_FILE} > tmp_previous_versions.yml
if [ $? -eq 0 ]; then
pnpm seed:local publish generator go-sdk --changelog $VERSIONS_FILE --previous-changelog tmp_previous_versions.yml --log-level debug
else
echo "No previous versions found, skipping publish."
fi
pnpm seed:local register generator --generators go-sdk
# Manually publish and register generators
# The logic is identical to the step above, but could not find a good way to work with the matrix AND manual trigger in one job
publish-manually:
runs-on: ubuntu-latest
# Only run this job if this has been triggered manually
if: ${{ github.event_name == 'workflow_dispatch' }}
steps:
- name: Checkout repo at current ref
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 2
- name: Install
uses: ./.github/actions/install
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Run publish
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
DOCKER_USERNAME: fernapi
DOCKER_PASSWORD: ${{ secrets.FERN_API_DOCKERHUB_PASSWORD }}
run: |
pnpm seed:local publish generator go-sdk --ver ${{ inputs.version }} --log-level debug
pnpm seed:local register generator --generators go-sdk