Skip to content

fix: fix some issues about database generator (#742) #93

fix: fix some issues about database generator (#742)

fix: fix some issues about database generator (#742) #93

Workflow file for this run

# Reference from:
# https://goreleaser.com/ci/actions/
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
Test:
name: Unit tests with coverage
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go 1.19
uses: actions/setup-go@v2
with:
go-version: 1.19
- name: Running go tests with coverage
env:
GO111MODULE: on
run: make cover
- name: Send coverage
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: coverage.out
Lint:
name: Lint checks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go 1.19
uses: actions/setup-go@v2
with:
go-version: 1.19
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.52.2
Publish: # Pack and publish image to Docker Hub and GitHub Release
runs-on: ubuntu-latest
needs: [Test, Lint]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19
# Get version information
- name: Get version
id: get_version
run: |
go generate ./pkg/version > version.txt
echo "kusion_version=$(cat version.txt | grep releaseVersion | cut -d ':' -f 2 | awk '$1=$1')" >> $GITHUB_OUTPUT
echo "kclgo_version=$(cat version.txt | grep kclGoVersion | cut -d ':' -f 2 | awk '$1=$1')" >> $GITHUB_OUTPUT
echo "kclplugin_version=$(cat version.txt | grep kclPluginVersion | cut -d ':' -f 2 | awk '$1=$1')" >> $GITHUB_OUTPUT
rm version.txt
# Check formal version or not
- name: Check Formal Version
id: check_formal_version
run: |
VERSION_PATTERN="^[0-9]+\.[0-9]+\.[0-9]+$"
if [[ "${{ steps.get_version.outputs.kusion_version }}" =~ ${VERSION_PATTERN} ]]; then
echo "is_formal_version=true" >> $GITHUB_OUTPUT
echo "Release a formal version!"
else
echo "is_formal_version=false" >> $GITHUB_OUTPUT
echo "Release an informal version!"
fi
# Login to Docker Hub
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Run informal GoReleaser
- name: Run Informal GoReleaser
if: ${{ steps.check_formal_version.outputs.is_formal_version == 'false' }}
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --config .goreleaser_informal.yml --clean
env:
GITHUB_TOKEN: ${{ secrets.KUSIONSTACK_BOT_TOKEN }}
KUSION_VERSION: ${{ steps.get_version.outputs.kusion_version }}
KCL_GO_VERSION: ${{ steps.get_version.outputs.kclgo_version }}
KCL_PLUGIN_VERSION: ${{ steps.get_version.outputs.kclplugin_version }}
# Run formal GoReleaser
- name: Run Formal GoReleaser
if: ${{ steps.check_formal_version.outputs.is_formal_version == 'true' }}
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.KUSIONSTACK_BOT_TOKEN }}
KUSION_VERSION: ${{ steps.get_version.outputs.kusion_version }}
KCL_GO_VERSION: ${{ steps.get_version.outputs.kclgo_version }}
KCL_PLUGIN_VERSION: ${{ steps.get_version.outputs.kclplugin_version }}