This repository has been archived by the owner on Oct 17, 2024. It is now read-only.
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: Code Test and Deploy | |
on: | |
push: | |
branches: v14-dev | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Nodejs | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Unit test | |
run: | | |
node -v | |
npm install | |
cp config.json.example config.json | |
npm test | |
deploy: | |
runs-on: ubuntu-22.04 | |
needs: test | |
steps: | |
- name: Setup Cloudflared and key | |
run: | | |
curl -fsSL https://pkg.cloudflare.com/cloudflare-main.gpg | sudo tee /usr/share/keyrings/cloudflare-main.gpg >/dev/null | |
echo 'deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/cloudflared focal main' | sudo tee /etc/apt/sources.list.d/cloudflared.list | |
sudo apt-get update && sudo apt-get install cloudflared | |
echo "${{ secrets.SSH_KEY }}" > ~/id_rsa | |
chmod 600 ~/id_rsa | |
cat known_hosts | |
- name: Deploy Sekai | |
run: | | |
ssh -i ~/id_rsa -o ProxyCommand="cloudflared access ssh --hostname ${{ secrets.SERVER_HOST }}" -o StrictHostKeyChecking=no -t ${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_HOST }} -p 22 "bash -x deploysekai.sh" |