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

sync bugfix #66

Merged
merged 1 commit into from
Jul 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/sync-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
uses: actions/setup-go@v1
env:
GO_VERSION: '1.16'
GOLANGCI_VERSION: 'v1.38'
GOLANGCI_VERSION: 'v1.45'
with:
go-version: ${{ env.GO_VERSION }}
id: go
Expand All @@ -36,4 +36,4 @@ jobs:
TAG: ${{ steps.get_version.outputs.TAG }}
COMMIT_ID: ${{ github.sha }}
run: |
bash ./hack/lib/sync.sh
bash ./hack/lib/sync-api.sh
28 changes: 20 additions & 8 deletions hack/lib/sync.sh → hack/lib/sync-api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,42 @@ git config --global user.email "openyurt-bot@openyurt.io"
git config --global user.name "openyurt-bot"
git clone --single-branch --depth 1 git@github.com:openyurtio/yurt-app-manager-api.git yurt-app-manager-api

echo "clear yurt-app-manager-api api/"
rm -r yurt-app-manager-api/pkg/yurtappmanager/apis/*
if [ -d "yurt-app-manager-api/pkg/yurtappmanager/apis" ]
then
echo "yurt-app-manager-api apis exists, remove it"
rm -r yurt-app-manager-api/pkg/yurtappmanager/apis/*
else
mkdir -p yurt-app-manager-api/pkg/yurtappmanager/apis
fi

echo "clear yurt-app-manager-api client/"
rm -r yurt-app-manager-api/pkg/yurtappmanager/client/*
if [ -d "yurt-app-manager-api/pkg/yurtappmanager/client" ]
then
echo "yurt-app-manager-api client exists, remove it"
rm -r yurt-app-manager-api/pkg/yurtappmanager/client/*
else
mkdir -p yurt-app-manager-api/pkg/yurtappmanager/client
fi

echo "update yurt-app-manager-api api/"
cp -R yurt-app-manager/pkg/yurtappmanager/apis/* yurt-app-manager-api/pkg/yurtappmanager/apis/
# remove controller depends functions
rm -r yurt-app-manager-api/pkg/yurtappmanager/apis/apps/v1alpha1/defaults.go

echo "update yurt-app-manager-api client/"
cp -R yurt-app-manager/pkg/yurtappmanager/client/* yurt-app-manager-api/pkg/yurtappmanager/client/

echo "change import path"
find ./yurt-app-manager-api -type f -name "*.go" -print0 | xargs -0 sed -i 's|github.com/openyurtio/yurt-app-manager/|github.com/openyurtio/yurt-app-manager-api/|g' ./yurt-app-manager-api/pkg/yurtappmanager/apis/addtoscheme_apps_v1alpha1.go
echo "change import paths, and change them"
find ./yurt-app-manager-api -type f -name "*.go" -print0 | xargs -0 sed -i 's|github.com/openyurtio/yurt-app-manager/|github.com/openyurtio/yurt-app-manager-api/|g'

echo "test api"
cd yurt-app-manager-api
go mod tidy
make test

echo "push to yurt-app-manager-api"
echo "version: $VERSION, commit: $COMMIT_ID, tag: $TAG"

if git diff --quiet
then
if [ -z "$(git status --porcelain)" ]; then
echo "nothing need to push, finished!"
else
git add .
Expand Down