Skip to content
This repository has been archived by the owner on Nov 6, 2024. It is now read-only.

Setup Go generator for monorepo (#2943) #1

Setup Go generator for monorepo (#2943)

Setup Go generator for monorepo (#2943) #1

name: publish-generators
on:
push:
branches:
- main
paths:
- "generators/openapi/VERSION"
- "generators/python/sdk/VERSION"
- "generators/python/fastapi/VERSION"
- "generators/python/pydantic/VERSION"
- "generators/postman/VERSION"
- "generators/ruby/model/VERSION"
- "generators/ruby/sdk/VERSION"
- "generators/java/sdk/VERSION"
- "generators/java/model/VERSION"
- "generators/java/spring/VERSION"
- "generators/typescript/sdk/VERSION"
- "generators/typescript/express/VERSION"
- "generators/go/VERSION"
workflow_dispatch:
inputs:
generator:
description: "The generator to publish a dev release for"
required: true
type: choice
options:
- openapi
- python-sdk
- fastapi
- pydantic
- postman
- ruby-sdk
- ruby-model
- java-sdk
- java-model
- java-spring
- typescript-sdk
- typescript-express
- go-sdk
- go-model
- go-fiber
jobs:
versions-changed:
runs-on: ubuntu-latest
outputs:
openapi: ${{ steps.filter.outputs.openapi }}
python-sdk: ${{ steps.filter.outputs.python-sdk }}
fastapi: ${{ steps.filter.outputs.fastapi }}
pydantic: ${{ steps.filter.outputs.pydantic }}
postman: ${{ steps.filter.outputs.postman }}
ruby-model: ${{ steps.filter.outputs.ruby-model }}
ruby-sdk: ${{ steps.filter.outputs.ruby-sdk }}
java-sdk: ${{ steps.filter.outputs.java-sdk }}
java-model: ${{ steps.filter.outputs.java-model }}
spring: ${{ steps.filter.outputs.spring }}
ts-sdk: ${{ steps.filter.outputs.ts-sdk }}
ts-express: ${{ steps.filter.outputs.ts-express }}
go-sdk: ${{ steps.filter.outputs.go-sdk }}
go-model: ${{ steps.filter.outputs.go-model }}
go-fiber: ${{ steps.filter.outputs.go-fiber }}
steps:
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
openapi: 'generators/openapi/VERSION'
python-sdk: 'generators/python/sdk/VERSION'
fastapi: 'generators/python/fastapi/VERSION'
pydantic: 'generators/python/pydantic/VERSION'
postman: 'generators/postman/VERSION'
ruby-model: 'generators/ruby/model/VERSION'
ruby-sdk: 'generators/ruby/sdk/VERSION'
java-sdk: 'generators/java/sdk/VERSION'
java-model: 'generators/java/model/VERSION'
spring: 'generators/java/spring/VERSION'
ts-sdk: 'generators/typescript/sdk/VERSION'
ts-express: 'generators/typescript/express/VERSION'
go-sdk: 'generators/go/VERSION'
go-model: 'generators/go/VERSION'
go-fiber: 'generators/go/VERSION'
pydantic-model:
runs-on: ubuntu-latest
needs: versions-changed
if: ${{ needs.versions-changed.outputs.pydantic == 'true' || inputs.generator == 'pydantic' }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install
working-directory: ./generators/python
run: poetry install
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: fernapi
password: ${{ secrets.FERN_API_DOCKERHUB_PASSWORD }}
- name: Print Version
if: ${{ inputs.generator != 'pydantic' }}
run: |
projectVersion=$(cat generators/python/pydantic/VERSION)
echo $projectVersion
echo "VERSION=$projectVersion" >> $GITHUB_ENV
- name: Print Version Dev
if: ${{ inputs.generator == 'pydantic' }}
run: |
projectVersion=$(cat generators/python/pydantic/VERSION)
commitNumber=$(git log --oneline | wc -l )
sha_short=$(git rev-parse --short HEAD)
echo $projectVersion-$commitNumber-$sha_short
echo "VERSION=$projectVersion-$commitNumber-$sha_short" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: ./generators/python
file: ./generators/python/pydantic/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: fernapi/fern-pydantic-model:${{env.VERSION}}
fastapi:
runs-on: ubuntu-latest
needs: versions-changed
if: ${{ needs.versions-changed.outputs.fastapi == 'true' || inputs.generator == 'fastapi' }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install
working-directory: ./generators/python
run: poetry install
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: fernapi
password: ${{ secrets.FERN_API_DOCKERHUB_PASSWORD }}
- name: Print Version
if: ${{ inputs.generator != 'fastapi' }}
run: |
projectVersion=$(cat generators/python/fastapi/VERSION)
echo $projectVersion
echo "VERSION=$projectVersion" >> $GITHUB_ENV
- name: Print Version Dev
if: ${{ inputs.generator == 'fastapi' }}
run: |
projectVersion=$(cat generators/python/fastapi/VERSION)
commitNumber=$(git log --oneline | wc -l )
sha_short=$(git rev-parse --short HEAD)
echo $projectVersion-$commitNumber-$sha_short
echo "VERSION=$projectVersion-$commitNumber-$sha_short" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: ./generators/python
file: ./generators/python/fastapi/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: fernapi/fern-fastapi-server:${{env.VERSION}}
python-sdk:
runs-on: ubuntu-latest
needs: versions-changed
if: ${{ needs.versions-changed.outputs.python-sdk == 'true' || inputs.generator == 'python-sdk' }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install
working-directory: ./generators/python
run: poetry install
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: fernapi
password: ${{ secrets.FERN_API_DOCKERHUB_PASSWORD }}
- name: Print Version
if: ${{ inputs.generator != 'python-sdk' }}
run: |
projectVersion=$(cat generators/python/sdk/VERSION)
echo $projectVersion
echo "VERSION=$projectVersion" >> $GITHUB_ENV
- name: Print Version Dev
if: ${{ inputs.generator == 'python-sdk' }}
run: |
projectVersion=$(cat generators/python/sdk/VERSION)
commitNumber=$(git log --oneline | wc -l )
sha_short=$(git rev-parse --short HEAD)
echo $projectVersion-$commitNumber-$sha_short
echo "VERSION=$projectVersion-$commitNumber-$sha_short" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: ./generators/python
file: ./generators/python/sdk/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: fernapi/fern-python-sdk:${{env.VERSION}}
openapi:
runs-on: ubuntu-latest
needs: versions-changed
if: ${{ needs.versions-changed.outputs.openapi == 'true' || inputs.generator == 'openapi' }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
cache: "yarn"
- name: Install
run: yarn install
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: fernapi
password: ${{ secrets.FERN_API_DOCKERHUB_PASSWORD }}
- name: Build CLI
working-directory: ./generators/openapi
run: yarn dist:cli
- name: Print Version
if: ${{ inputs.generator != 'openapi' }}
run: |
projectVersion=$(cat generators/openapi/VERSION)
echo $projectVersion
echo "VERSION=$projectVersion" >> $GITHUB_ENV
- name: Print Version Dev
if: ${{ inputs.generator == 'openapi' }}
run: |
projectVersion=$(cat generators/openapi/VERSION)
commitNumber=$(git log --oneline | wc -l )
sha_short=$(git rev-parse --short HEAD)
echo $projectVersion-$commitNumber-$sha_short
echo "VERSION=$projectVersion-$commitNumber-$sha_short" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: ./generators/openapi
file: ./generators/openapi/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: fernapi/fern-openapi:${{env.VERSION}}
postman:
runs-on: ubuntu-latest
needs: versions-changed
if: ${{ needs.versions-changed.outputs.postman == 'true' || inputs.generator == 'postman' }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
cache: "yarn"
- name: Install
run: yarn install
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: fernapi
password: ${{ secrets.FERN_API_DOCKERHUB_PASSWORD }}
- name: Build CLI
working-directory: ./generators/postman
run: yarn dist:cli
- name: Print Version
if: ${{ inputs.generator != 'postman' }}
run: |
projectVersion=$(cat generators/postman/VERSION)
echo $projectVersion
echo "VERSION=$projectVersion" >> $GITHUB_ENV
- name: Print Version Dev
if: ${{ inputs.generator == 'postman' }}
run: |
projectVersion=$(cat generators/postman/VERSION)
commitNumber=$(git log --oneline | wc -l )
sha_short=$(git rev-parse --short HEAD)
echo $projectVersion-$commitNumber-$sha_short
echo "VERSION=$projectVersion-$commitNumber-$sha_short" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: ./generators/postman
file: ./generators/postman/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: fernapi/fern-postman:${{env.VERSION}}
ruby-model:
runs-on: ubuntu-latest
needs: versions-changed
if: ${{ needs.versions-changed.outputs.ruby-model == 'true' || inputs.generator == 'ruby-model' }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
cache: "yarn"
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: fernapi
password: ${{ secrets.FERN_API_DOCKERHUB_PASSWORD }}
- name: Install
run: yarn install
- name: Build CLI
working-directory: ./generators/ruby/model
run: yarn dist:cli
- name: Print Version
if: ${{ inputs.generator != 'ruby-model' }}
run: |
projectVersion=$(cat generators/ruby/model/VERSION)
echo $projectVersion
echo "VERSION=$projectVersion" >> $GITHUB_ENV
- name: Print Version Dev
if: ${{ inputs.generator == 'ruby-model' }}
run: |
projectVersion=$(cat generators/ruby/model/VERSION)
commitNumber=$(git log --oneline | wc -l )
sha_short=$(git rev-parse --short HEAD)
echo $projectVersion-$commitNumber-$sha_short
echo "VERSION=$projectVersion-$commitNumber-$sha_short" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
file: ./generators/ruby/model/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: fernapi/fern-ruby-model:${{env.VERSION}}
ruby-sdk:
runs-on: ubuntu-latest
needs: versions-changed
if: ${{ needs.versions-changed.outputs.ruby-sdk == 'true' || inputs.generator == 'ruby-sdk' }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
cache: "yarn"
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: fernapi
password: ${{ secrets.FERN_API_DOCKERHUB_PASSWORD }}
- name: Install
run: yarn install
- name: Build CLI
working-directory: ./generators/ruby/sdk
run: yarn dist:cli
- name: Print Version
if: ${{ inputs.generator != 'ruby-sdk' }}
run: |
projectVersion=$(cat generators/ruby/sdk/VERSION)
echo $projectVersion
echo "VERSION=$projectVersion" >> $GITHUB_ENV
- name: Print Version Dev
if: ${{ inputs.generator == 'ruby-sdk' }}
run: |
projectVersion=$(cat generators/ruby/sdk/VERSION)
commitNumber=$(git log --oneline | wc -l )
sha_short=$(git rev-parse --short HEAD)
echo $projectVersion-$commitNumber-$sha_short
echo "VERSION=$projectVersion-$commitNumber-$sha_short" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
file: ./generators/ruby/sdk/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: fernapi/fern-ruby-sdk:${{env.VERSION}}
java-sdk:
runs-on: ubuntu-latest
needs: versions-changed
if: ${{ needs.versions-changed.outputs.java-sdk == 'true' || inputs.generator == 'java-sdk' }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: fernapi
password: ${{ secrets.FERN_API_DOCKERHUB_PASSWORD }}
- name: Build tar
working-directory: ./generators/java
run: ./gradlew :sdk:distTar
- name: Print Version
if: ${{ inputs.generator != 'java-sdk' }}
run: |
projectVersion=$(cat generators/java/sdk/VERSION)
echo $projectVersion
echo "VERSION=$projectVersion" >> $GITHUB_ENV
- name: Print Version Dev
if: ${{ inputs.generator == 'java-sdk' }}
run: |
projectVersion=$(cat generators/java/sdk/VERSION)
commitNumber=$(git log --oneline | wc -l )
sha_short=$(git rev-parse --short HEAD)
echo $projectVersion-$commitNumber-$sha_short
echo "VERSION=$projectVersion-$commitNumber-$sha_short" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: ./generators/java/sdk
file: ./generators/java/sdk/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: fernapi/fern-java-sdk:${{env.VERSION}}
java-model:
runs-on: ubuntu-latest
needs: versions-changed
if: ${{ needs.versions-changed.outputs.java-model == 'true' || inputs.generator == 'java-model' }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: fernapi
password: ${{ secrets.FERN_API_DOCKERHUB_PASSWORD }}
- name: Build tar
working-directory: ./generators/java
run: ./gradlew :model:distTar
- name: Print Version
if: ${{ inputs.generator != 'java-model' }}
run: |
projectVersion=$(cat generators/java/model/VERSION)
echo $projectVersion
echo "VERSION=$projectVersion" >> $GITHUB_ENV
- name: Print Version Dev
if: ${{ inputs.generator == 'java-model' }}
run: |
projectVersion=$(cat generators/java/model/VERSION)
commitNumber=$(git log --oneline | wc -l )
sha_short=$(git rev-parse --short HEAD)
echo $projectVersion-$commitNumber-$sha_short
echo "VERSION=$projectVersion-$commitNumber-$sha_short" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: ./generators/java/model
file: ./generators/java/model/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: fernapi/java-model:${{env.VERSION}}
java-spring:
runs-on: ubuntu-latest
needs: versions-changed
if: ${{ needs.versions-changed.outputs.java-model == 'true' || inputs.generator == 'java-spring' }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: fernapi
password: ${{ secrets.FERN_API_DOCKERHUB_PASSWORD }}
- name: Build tar
working-directory: ./generators/java
run: ./gradlew :spring:distTar
- name: Print Version
if: ${{ inputs.generator != 'java-spring' }}
run: |
projectVersion=$(cat generators/java/spring/VERSION)
echo $projectVersion
echo "VERSION=$projectVersion" >> $GITHUB_ENV
- name: Print Version Dev
if: ${{ inputs.generator == 'java-spring' }}
run: |
projectVersion=$(cat generators/java/spring/VERSION)
commitNumber=$(git log --oneline | wc -l )
sha_short=$(git rev-parse --short HEAD)
echo $projectVersion-$commitNumber-$sha_short
echo "VERSION=$projectVersion-$commitNumber-$sha_short" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: ./generators/java/spring
file: ./generators/java/spring/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: fernapi/fern-java-spring:${{env.VERSION}}
ts-express:
runs-on: ubuntu-latest
needs: versions-changed
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
cache: "yarn"
- name: Install
run: yarn install
- name: Print Version
if: ${{ inputs.generator != 'ts-sdk' }}
run: |
projectVersion=$(cat generators/typescript/sdk/VERSION)
echo $projectVersion
echo "VERSION=$projectVersion" >> $GITHUB_ENV
- name: Print Version Dev
if: ${{ inputs.generator == 'ts-sdk' }}
run: |
projectVersion=$(cat generators/typescript/sdk/VERSION)
commitNumber=$(git log --oneline | wc -l )
sha_short=$(git rev-parse --short HEAD)
echo $projectVersion-$commitNumber-$sha_short
echo "VERSION=$projectVersion-$commitNumber-$sha_short" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: fernapi
password: ${{ secrets.FERN_API_DOCKERHUB_PASSWORD }}
- name: Publish fernapi/fern-typescript-node-sdk docker
run: |
yarn workspace @fern-typescript/express-generator-cli dockerTagVersion "$VERSION"
docker push fernapi/fern-typescript-express:"$VERSION"
ts-browser-sdk:
runs-on: ubuntu-latest
needs: versions-changed
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
cache: "yarn"
- name: Install
run: yarn install
- name: Print Version
if: ${{ inputs.generator != 'ts-sdk' }}
run: |
projectVersion=$(cat generators/typescript/sdk/VERSION)
echo $projectVersion
echo "VERSION=$projectVersion" >> $GITHUB_ENV
- name: Print Version Dev
if: ${{ inputs.generator == 'ts-sdk' }}
run: |
projectVersion=$(cat generators/typescript/sdk/VERSION)
commitNumber=$(git log --oneline | wc -l )
sha_short=$(git rev-parse --short HEAD)
echo $projectVersion-$commitNumber-$sha_short
echo "VERSION=$projectVersion-$commitNumber-$sha_short" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: fernapi
password: ${{ secrets.FERN_API_DOCKERHUB_PASSWORD }}
- name: Publish fernapi/fern-typescript-node-sdk docker
run: |
yarn workspace @fern-typescript/sdk-generator-cli dockerTagVersion:browser "$VERSION"
docker push fernapi/fern-typescript-browser-sdk:"$VERSION"
ts-node-sdk:
runs-on: ubuntu-latest
needs: versions-changed
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
cache: "yarn"
- name: Install
run: yarn install
- name: Print Version
if: ${{ inputs.generator != 'ts-sdk' }}
run: |
projectVersion=$(cat generators/typescript/sdk/VERSION)
echo $projectVersion
echo "VERSION=$projectVersion" >> $GITHUB_ENV
- name: Print Version Dev
if: ${{ inputs.generator == 'ts-sdk' }}
run: |
projectVersion=$(cat generators/typescript/sdk/VERSION)
commitNumber=$(git log --oneline | wc -l )
sha_short=$(git rev-parse --short HEAD)
echo $projectVersion-$commitNumber-$sha_short
echo "VERSION=$projectVersion-$commitNumber-$sha_short" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: fernapi
password: ${{ secrets.FERN_API_DOCKERHUB_PASSWORD }}
- name: Publish fernapi/fern-typescript-node-sdk docker
run: |
yarn workspace @fern-typescript/sdk-generator-cli dockerTagVersion:node "$VERSION"
docker push fernapi/fern-typescript-node-sdk:"$VERSION"
go-sdk:
runs-on: ubuntu-latest
needs: versions-changed
if: ${{ needs.versions-changed.outputs.go-sdk == 'true' || inputs.generator == 'go-sdk' }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: fernapi
password: ${{ secrets.FERN_API_DOCKERHUB_PASSWORD }}
- name: Build CLI
working-directory: ./generators/go
run: go build ./...
- name: Print Version
if: ${{ inputs.generator != 'go-sdk' }}
run: |
projectVersion=$(cat generators/go/VERSION)
echo $projectVersion
echo "VERSION=$projectVersion" >> $GITHUB_ENV
- name: Print Version Dev
if: ${{ inputs.generator == 'go-sdk' }}
run: |
projectVersion=$(cat generators/go/VERSION)
commitNumber=$(git log --oneline | wc -l )
sha_short=$(git rev-parse --short HEAD)
echo $projectVersion-$commitNumber-$sha_short
echo "VERSION=$projectVersion-$commitNumber-$sha_short" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: ./generators/go
file: ./generators/go/docker/Dockerfile.sdk
platforms: linux/amd64,linux/arm64
push: true
tags: fernapi/fern-go-sdk:${{env.VERSION}}
go-model:
runs-on: ubuntu-latest
needs: versions-changed
if: ${{ needs.versions-changed.outputs.go-model == 'true' || inputs.generator == 'go-model' }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: fernapi
password: ${{ secrets.FERN_API_DOCKERHUB_PASSWORD }}
- name: Build CLI
working-directory: ./generators/go
run: go build ./...
- name: Print Version
if: ${{ inputs.generator != 'go-model' }}
run: |
projectVersion=$(cat generators/go/VERSION)
echo $projectVersion
echo "VERSION=$projectVersion" >> $GITHUB_ENV
- name: Print Version Dev
if: ${{ inputs.generator == 'go-model' }}
run: |
projectVersion=$(cat generators/go/VERSION)
commitNumber=$(git log --oneline | wc -l )
sha_short=$(git rev-parse --short HEAD)
echo $projectVersion-$commitNumber-$sha_short
echo "VERSION=$projectVersion-$commitNumber-$sha_short" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: ./generators/go
file: ./generators/go/docker/Dockerfile.model
platforms: linux/amd64,linux/arm64
push: true
tags: fernapi/fern-go-model:${{env.VERSION}}
go-fiber:
runs-on: ubuntu-latest
needs: versions-changed
if: ${{ needs.versions-changed.outputs.go-fiber == 'true' || inputs.generator == 'go-fiber' }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: fernapi
password: ${{ secrets.FERN_API_DOCKERHUB_PASSWORD }}
- name: Build CLI
working-directory: ./generators/go
run: go build ./...
- name: Print Version
if: ${{ inputs.generator != 'go-fiber' }}
run: |
projectVersion=$(cat generators/go/VERSION)
echo $projectVersion
echo "VERSION=$projectVersion" >> $GITHUB_ENV
- name: Print Version Dev
if: ${{ inputs.generator == 'go-fiber' }}
run: |
projectVersion=$(cat generators/go/VERSION)
commitNumber=$(git log --oneline | wc -l )
sha_short=$(git rev-parse --short HEAD)
echo $projectVersion-$commitNumber-$sha_short
echo "VERSION=$projectVersion-$commitNumber-$sha_short" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: ./generators/go
file: ./generators/go/docker/Dockerfile.fiber
platforms: linux/amd64,linux/arm64
push: true
tags: fernapi/fern-go-fiber:${{env.VERSION}}