Skip to content

Commit 958fd57

Browse files
committed
Always run the workflows
1 parent 8776ae5 commit 958fd57

File tree

2 files changed

+69
-67
lines changed

2 files changed

+69
-67
lines changed

.github/workflows/build.yml

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ name: Build
22

33
on:
44
push:
5-
branches:
6-
- master
7-
- 'ver/**'
85

96
jobs:
107
build:
@@ -49,27 +46,28 @@ jobs:
4946
run: 'yarn run docs:build'
5047

5148
- name: Push to Build Branch
52-
run: |
53-
git config --global user.name 'github-actions[bot]'
54-
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
55-
56-
BRANCH=$(echo ${GITHUB_REF} | sed -e 's/refs\/heads\///')
57-
TARGET_BRANCH="build/${BRANCH}"
58-
59-
if git ls-remote --heads origin ${TARGET_BRANCH} | grep ${TARGET_BRANCH}; then
60-
git push origin --delete ${TARGET_BRANCH}
61-
fi
62-
63-
find . -mindepth 1 -maxdepth 1 ! -name 'docs' ! -name '.git' -exec rm -rf {} +
64-
find docs -mindepth 1 -maxdepth 1 ! -name '.vitepress' -exec rm -rf {} +
65-
cp -r docs/.vitepress/dist/* .
66-
rm -rf docs
67-
68-
git checkout -b "${TARGET_BRANCH}"
69-
git add .
70-
git commit -m "GitHub Actions Auto Build ${BRANCH}"
71-
72-
echo "Branch: ${BRANCH}"
73-
echo "Pushing to ${TARGET_BRANCH}"
74-
75-
git push origin "${TARGET_BRANCH}"
49+
run: echo This ran!
50+
# run: |
51+
# git config --global user.name 'github-actions[bot]'
52+
# git config --global user.email 'github-actions[bot]@users.noreply.github.com'
53+
#
54+
# BRANCH=$(echo ${GITHUB_REF} | sed -e 's/refs\/heads\///')
55+
# TARGET_BRANCH="build/${BRANCH}"
56+
#
57+
# if git ls-remote --heads origin ${TARGET_BRANCH} | grep ${TARGET_BRANCH}; then
58+
# git push origin --delete ${TARGET_BRANCH}
59+
# fi
60+
#
61+
# find . -mindepth 1 -maxdepth 1 ! -name 'docs' ! -name '.git' -exec rm -rf {} +
62+
# find docs -mindepth 1 -maxdepth 1 ! -name '.vitepress' -exec rm -rf {} +
63+
# cp -r docs/.vitepress/dist/* .
64+
# rm -rf docs
65+
#
66+
# git checkout -b "${TARGET_BRANCH}"
67+
# git add .
68+
# git commit -m "GitHub Actions Auto Build ${BRANCH}"
69+
#
70+
# echo "Branch: ${BRANCH}"
71+
# echo "Pushing to ${TARGET_BRANCH}"
72+
#
73+
# git push origin "${TARGET_BRANCH}"

.github/workflows/deploy.yml

Lines changed: 44 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
workflow_run:
55
workflows: [ Build ]
66
types: [ completed ]
7+
branches:
8+
- 'master'
9+
- 'ver/**'
710
push:
811
branches:
912
- 'build/**'
@@ -18,43 +21,44 @@ jobs:
1821
uses: actions/checkout@v2
1922

2023
- name: Merge Build Branches
21-
run: |
22-
CNAME='docs.commandapi.dev'
23-
24-
git config --global user.name 'github-actions[bot]'
25-
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
26-
27-
TARGET_BRANCH="deploy"
28-
BASE_BRANCH="origin/build/master"
29-
ORIGIN_URL=$(git remote get-url origin)
30-
SUFFIX=".git"
31-
TARGET_URL=${ORIGIN_URL%$SUFFIX}
32-
33-
git fetch origin
34-
git checkout -b ${TARGET_BRANCH} ${BASE_BRANCH}
35-
36-
BRANCHES=$(git branch -r | grep 'origin/build/ver/')
37-
38-
for BRANCH in $BRANCHES; do
39-
BRANCH_NAME=$(echo $BRANCH | sed 's|origin/||')
40-
LOCAL_DIR=$(echo $BRANCH_NAME | sed 's|build/ver/||')
41-
TARGET_ZIP="${TARGET_URL}/archive/refs/heads/${BRANCH_NAME}.zip"
42-
43-
echo "Branch: ${BRANCH_NAME}"
44-
echo "URL: ${TARGET_ZIP}"
45-
echo "Local: ${LOCAL_DIR}"
46-
47-
mkdir -p ${LOCAL_DIR}
48-
wget --max-redirect=10 -O ${LOCAL_DIR}/dist.zip ${TARGET_ZIP}
49-
TEMP_DIR=$(mktemp -d)
50-
unzip ${LOCAL_DIR}/dist.zip -d ${TEMP_DIR}
51-
mv ${TEMP_DIR}/*/* ${LOCAL_DIR}
52-
rm ${LOCAL_DIR}/dist.zip
53-
done
54-
55-
echo ${CNAME} > CNAME
56-
57-
git add .
58-
git commit -m "GitHub Actions Auto Deploy"
59-
60-
git push -f origin "${TARGET_BRANCH}"
24+
run: echo Sadly, this also ran!
25+
# run: |
26+
# CNAME='docs.commandapi.dev'
27+
#
28+
# git config --global user.name 'github-actions[bot]'
29+
# git config --global user.email 'github-actions[bot]@users.noreply.github.com'
30+
#
31+
# TARGET_BRANCH="deploy"
32+
# BASE_BRANCH="origin/build/master"
33+
# ORIGIN_URL=$(git remote get-url origin)
34+
# SUFFIX=".git"
35+
# TARGET_URL=${ORIGIN_URL%$SUFFIX}
36+
#
37+
# git fetch origin
38+
# git checkout -b ${TARGET_BRANCH} ${BASE_BRANCH}
39+
#
40+
# BRANCHES=$(git branch -r | grep 'origin/build/ver/')
41+
#
42+
# for BRANCH in $BRANCHES; do
43+
# BRANCH_NAME=$(echo $BRANCH | sed 's|origin/||')
44+
# LOCAL_DIR=$(echo $BRANCH_NAME | sed 's|build/ver/||')
45+
# TARGET_ZIP="${TARGET_URL}/archive/refs/heads/${BRANCH_NAME}.zip"
46+
#
47+
# echo "Branch: ${BRANCH_NAME}"
48+
# echo "URL: ${TARGET_ZIP}"
49+
# echo "Local: ${LOCAL_DIR}"
50+
#
51+
# mkdir -p ${LOCAL_DIR}
52+
# wget --max-redirect=10 -O ${LOCAL_DIR}/dist.zip ${TARGET_ZIP}
53+
# TEMP_DIR=$(mktemp -d)
54+
# unzip ${LOCAL_DIR}/dist.zip -d ${TEMP_DIR}
55+
# mv ${TEMP_DIR}/*/* ${LOCAL_DIR}
56+
# rm ${LOCAL_DIR}/dist.zip
57+
# done
58+
#
59+
# echo ${CNAME} > CNAME
60+
#
61+
# git add .
62+
# git commit -m "GitHub Actions Auto Deploy"
63+
#
64+
# git push -f origin "${TARGET_BRANCH}"

0 commit comments

Comments
 (0)