Skip to content

Update links to the new beta version #95

Update links to the new beta version

Update links to the new beta version #95

Workflow file for this run

name: Publish to gh-pages
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "14"
- name: Install coscmd
run: sudo pip install coscmd
- name: Configure coscmd
env:
SECRET_ID: ${{ secrets.SecretId }}
SECRET_KEY: ${{ secrets.SecretKey }}
BUCKET: ${{ secrets.Bucket }}
REGION: ${{ secrets.Region }}
run: coscmd config -a $SECRET_ID -s $SECRET_KEY -b $BUCKET -r $REGION
- run: npm install
- run: npm run build
- name: Publish static files to COS
run: |
coscmd upload -rs --delete -f ./build/static/ /
rm -rf build/static
# Rewrite links to static files
sed -i 's|"/qieyun-autoderiver/static/|"https://qieyun-autoderiver-1305783649.file.myqcloud.com/|g' build/*.*
- name: Publish to GitHub Pages
run: |
# Create a temporary directory
export temp_dir=`mktemp -d -p ~`
(
# Preserve .git
mkdir $temp_dir/temp
mv .git $temp_dir/temp
cd $temp_dir/temp
# Switch branch
git fetch
git checkout gh-pages
git reset --hard gh-pages
)
(
# Move .git
mv $temp_dir/temp/.git $temp_dir
rm -rf $temp_dir/temp
mv build/* $temp_dir
mv LICENSE $temp_dir
# Go to the temporary directory
cd $temp_dir
# Set commit identity
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
# Publish
git add .
if [ -n "$(git status --porcelain)" ]; then
git commit -m "Publish `TZ='Asia/Hong_Kong' date`"
git push -f origin gh-pages
fi
)