build pages and deploy #1
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: Publish Pages | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v1 | |
with: | |
fetch-depth: 0 | |
- name: deploy | |
run: | | |
remote_addr=`git remote get-url --push origin` | |
commit_info=`git describe --all --always --long` | |
user_name=`git log -1 --pretty=format:'%an'` | |
user_email=`git log -1 --pretty=format:'%ae'` | |
rm data/README | |
ls data/vocal>data/vocal.txt | |
ls data/music>data/music.txt | |
cp -r data www | |
cd www | |
git config --global init.defaultBranch gh-pages | |
git init | |
git config user.name ${user_name} | |
git config user.email ${user_email} | |
git add -A | |
git commit -m "auto deploy, $commit_info" | |
remote_addr=`echo $remote_addr | awk -F'://' '{print $2}'` | |
remote_addr=https://${user_name}:${{secrets.GITHUB_TOKEN}}@${remote_addr} | |
git remote add origin ${remote_addr} | |
git push origin HEAD:gh-pages --force |