Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release Docker Image and Pypi Package | |
on: | |
release: | |
types: [published] | |
jobs: | |
version-release-for-github-pages: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
lfs: true | |
- name: Use Node.js 16 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
cache: "yarn" | |
cache-dependency-path: "./yarn.lock" | |
- name: Get yarn cache directory path | |
id: yarn-cache-docs-dir-path | |
run: | | |
echo "::set-output name=dir::" | |
yarn cache dir | |
- uses: actions/cache@v3 | |
id: yarn-cache-docs | |
with: | |
path: | | |
${{ steps.yarn-cache-docs-dir-path.outputs.dir }} | |
**/node_modules | |
key: ${{ runner.os }}-yarn-docs-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn-docs- | |
- name: Install docs dependencies | |
if: steps.yarn-cache-docs.outputs.cache-hit != 'true' # Over here! | |
run: make install-req | |
- name: Checkout gh-pages branch for archived versions docs | |
uses: actions/checkout@v3 | |
with: | |
ref: gh-pages | |
path: gh-pages | |
sparse-checkout: | | |
.archived-versions | |
- name: Copy archived version files | |
run: | | |
[ ! -d gh-pages/.archived-versions ] && exit 0 | |
cp gh-pages/.archived-versions/versions.json ./ | |
cp -R gh-pages/.archived-versions/versioned_sidebars ./ | |
cp -R gh-pages/.archived-versions/versioned_docs ./ | |
cp -R gh-pages/.archived-versions/i18n/zh/docusaurus-plugin-content-docs/version-* ./i18n/zh/docusaurus-plugin-content-docs/ | |
- name: Get tag | |
id: tag | |
uses: dawidd6/action-get-tag@v1 | |
with: | |
strip_v: true | |
- name: Generate new release version | |
env: | |
RELEASE_VERSION: ${{ steps.tag.outputs.tag }} | |
run: make versioning-docs | |
- name: Lint docs | |
run: make lint-docs | |
- name: Build docs | |
run: make build-docs | |
- name: Update archived version files | |
run: | | |
mkdir -p build/.archived-versions | |
cp versions.json build/.archived-versions/ | |
cp -R versioned_sidebars build/.archived-versions/ | |
cp -R versioned_docs build/.archived-versions/ | |
mkdir -p build/.archived-versions/i18n/zh/docusaurus-plugin-content-docs | |
cp -R i18n/zh/docusaurus-plugin-content-docs/version-* build/.archived-versions/i18n/zh/docusaurus-plugin-content-docs/ | |
- name: Publish to Github Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./build | |
user_name: github-actions[bot] | |
cname: doc.starwhale.ai | |
user_email: "github-actions[bot]@users.noreply.github.com" | |
#TODO: refactor with main-release-for-starwhale-cn job in the docs.yaml | |
version-release-for-starwhale-cn: | |
runs-on: self-hosted | |
needs: | |
- version-release-for-github-pages | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
lfs: true | |
- name: Install docs dependencies | |
run: | | |
yarn config set registry https://registry.npmmirror.com | |
npm config set registry https://registry.npm.taobao.org | |
make install-req | |
- name: Checkout gh-pages branch for archived versions docs | |
uses: actions/checkout@v3 | |
with: | |
ref: gh-pages | |
path: gh-pages | |
sparse-checkout: | | |
.archived-versions | |
- name: Copy archived version files | |
run: | | |
[ ! -d gh-pages/.archived-versions ] && exit 0 | |
cp gh-pages/.archived-versions/versions.json ./ | |
cp -R gh-pages/.archived-versions/versioned_sidebars ./ | |
cp -R gh-pages/.archived-versions/versioned_docs ./ | |
cp -R gh-pages/.archived-versions/i18n/zh/docusaurus-plugin-content-docs/version-* ./i18n/zh/docusaurus-plugin-content-docs/ | |
- name: Build docs | |
run: make build-docs | |
env: | |
DEFAULT_LOCALE: "zh" | |
URL: "https://starwhale.cn" | |
ORG: "starwhale.cn" | |
BASE_URL: "/docs/" | |
- name: Publish docs | |
uses: appleboy/[email protected] | |
with: | |
debug: true | |
host: ${{ secrets.DOC_RELEASE_HOST }} | |
username: ${{ secrets.DOC_RELEASE_USER }} | |
key: ${{ secrets.DOC_RELEASE_KEY }} | |
source: "build/*" | |
target: "/data/www/starwhale-cn-docs/docs/" | |
strip_components: 1 | |
rm: true |