Update main.yml #49
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: CDN CI | |
on: | |
push: | |
branches: [ main ] | |
env: | |
SERVER_IP: ${{ secrets.SERVER_IP }} | |
USERNAME: ${{ secrets.SERVER_USER }} | |
PWD: ${{ secrets.SERVER_PWD }} | |
TARGET_DIR: ${{ secrets.TARGET_DIR }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Deno | |
uses: denolib/setup-deno@master | |
with: | |
deno-version: 1.43.3 | |
- name: "Compile all assets into one folder." | |
run: bash build.sh | |
- name: "Push to the \"deploy\" branch." | |
uses: JamesIves/[email protected] | |
with: | |
branch: deploy | |
folder: cdn | |
- name: "Upload to server." | |
run: | | |
sshpass -p ${{ env.PWD }} ssh -o "StrictHostKeyChecking=no" ${{ env.USERNAME }}@${{ env.SERVER_IP }} "cd ${{ env.TARGET_DIR }};rm -rf *;" | |
sshpass -p ${{ env.PWD }} ssh -o "StrictHostKeyChecking=no" ${{ env.USERNAME }}@${{ env.SERVER_IP }} "cd ${{ env.TARGET_DIR }};git clone https://github.com/alyxshang/spark-cdn -b deploy" | |
sshpass -p ${{ env.PWD }} ssh -o "StrictHostKeyChecking=no" ${{ env.USERNAME }}@${{ env.SERVER_IP }} "cd ${{ env.TARGET_DIR }};mv -rf spark-cdn/* .;rm -rf spark-cdn" |