diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3783e1a79..f037a7f02 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -82,4 +82,14 @@ jobs: upload_url: ${{ steps.get_release.outputs.upload_url }} asset_path: ./_bin/sha256sums.txt asset_name: sha256sums.txt - asset_content_type: text/plain \ No newline at end of file + asset_content_type: text/plain + - uses: actions/setup-node@v1 + with: + node-version: '12.x' + - name: Sync release to kubevela.io Repo + env: + SSH_DEPLOY_KEY: ${{ secrets.GH_PAGES_DEPLOY }} + VERSION: ${{ steps.get_version.outputs.VERSION }} + COMMIT_ID: ${{ github.sha }} + run: | + bash ./hack/website/release.sh \ No newline at end of file diff --git a/hack/website/release.sh b/hack/website/release.sh index 9b45a2586..da81aec5a 100644 --- a/hack/website/release.sh +++ b/hack/website/release.sh @@ -49,7 +49,38 @@ cp -R docs/en/* git-page/docs/ echo "git push" cd git-page -# Check for release only +# Check for release created only +SUB='v' +if [[ "$VERSION" == "$SUB"* ]] +then + # vx.y.z -> vx.y + sub="." + major="$(cut -d"$sub" -f1 <<<"$VERSION")" + minor="$(cut -d"$sub" -f2 <<<"$VERSION")" + + version=${major}.${minor} + echo "updating website for version $version" + + if grep -q $version versions.json; then + rm -r versioned_docs/version-${version}/ + rm versioned_sidebars/version-${version}-sidebars.json + sed -i.bak "/${version}/d" versions.json + rm versions.json.bak + fi + + yarn add nodejieba + if [ -e yarn.lock ]; then + yarn install --frozen-lockfile + elif [ -e package-lock.json ]; then + npm ci + else + npm i + fi + + yarn run docusaurus docs:version $version +fi + +# Check for release branch update only SUB='release-' if [[ "$VERSION" == *"$SUB"* ]] then @@ -77,6 +108,8 @@ then yarn run docusaurus docs:version $version fi + + if git diff --quiet then echo "nothing need to push, finished!"