Skip to content

Commit 493a3ca

Browse files
committed
feat: publish to divided branch
1 parent 30159e5 commit 493a3ca

File tree

1 file changed

+8
-22
lines changed

1 file changed

+8
-22
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,13 @@ jobs:
3030
git config --global user.name 'github-actions[bot]'
3131
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
3232
33-
if [ "${GITHUB_REF}" == "refs/heads/master" ]; then
34-
TARGET_DIR="."
35-
else
36-
VERSION=$(echo ${GITHUB_REF} | sed -e 's/refs\/heads\/ver\///')
37-
TARGET_DIR="${VERSION}"
38-
fi
39-
40-
git fetch origin
41-
if ! git show-ref --quiet refs/heads/publish; then
42-
git checkout --orphan publish
43-
git rm -rf .
44-
git commit --allow-empty -m "Initial"
45-
git push origin publish
46-
else
47-
git checkout -b publish origin/publish
48-
fi
49-
50-
mkdir -p ${TARGET_DIR}
51-
find "$TARGET_DIR" -mindepth 1 -not -regex '.*/[0-9]+\.[0-9]+\.[0-9]+$' -exec rm -rf {} +
52-
cp -r dist/* ${TARGET_DIR}/
33+
BRANCH=$(echo ${GITHUB_REF} | sed -e 's/refs\/heads\///')
34+
TARGET_BRANCH="build/${BRANCH}"
35+
COMMIT_MSG=$(git log -1 --pretty=%B)
5336
37+
cd docs/.vitepress/dist
38+
39+
git init
5440
git add .
55-
git commit -C ${GITHUB_SHA}
56-
git push origin publish
41+
git commit -m ${COMMIT_MSG}
42+
git push origin ${TARGET_BRANCH}

0 commit comments

Comments
 (0)