Skip to content

Update: Shucheng Li ( https://snli.org ) #123

Update: Shucheng Li ( https://snli.org )

Update: Shucheng Li ( https://snli.org ) #123

Workflow file for this run

name: Friends
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 16.x
- name: Change apt mirror
run: |
sudo sed -i 's/azure.archive.ubuntu.com/archive.ubuntu.com/' /etc/apt/sources.list
sudo apt-get update
- run: sudo apt-get install imagemagick graphicsmagick -y
- run: npm set audit false && node -v && npm -v
- run: npm install
- run: npm run build
- name: Deploy to GitHub Pages
if: ${{ github.event_name == 'push' }}
uses: crazy-max/ghaction-github-pages@v2.5.0
with:
target_branch: gh-pages
build_dir: dist
committer: BaoshuoBot <bot@baoshuo.ren>
author: Ren Baoshuo <i@baoshuo.ren>
commit_message: "deploy: ${{ github.sha }}"
keep_history: true
fqdn: friends.baoshuo.ren
jekyll: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
sync:
if: ${{ github.event_name == 'push' && github.repository_owner == 'renbaoshuo' }}
runs-on: ubuntu-latest
needs:
- build
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: gh-pages
path: friends
- name: Checkout renbaoshuo/cdn-sb
uses: actions/checkout@v3
with:
repository: renbaoshuo/cdn-sb
ssh-key: ${{ secrets.CDN_SB_SSH_PRIVATE_KEY }}
path: cdn-sb
- name: Copy Files
run: |
rm -rf cdn-sb/public/friends
rm -rf friends/.git
cp -rf friends cdn-sb/public/friends
- id: get-commit-sha
run: |
id="${{ github.sha }}"
echo "id=${id:0:7}" >> $GITHUB_OUTPUT
- name: Upload
run: |
cd cdn-sb
git config --global user.name BaoshuoBot
git config --global user.email bot@baoshuo.dev
git add public/friends
git commit -m "[Friends/${{ steps.get-commit-sha.outputs.id }}] Upload dist on $(date '+%Y-%m-%d %H:%M:%S')" --allow-empty
git push