hapl #35
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: Node.js CI | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '17' # Adjust to the appropriate Node.js version | |
- name: Install dependencies | |
run: npm install --force | |
- name: Install SSH keys | |
run: | | |
mkdir -p ~/.ssh | |
touch ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
echo "${{ secrets.DEPLOY_RSA }}" > ~/.ssh/id_rsa | |
ssh-keyscan -H ituk.ee > ~/.ssh/known_hosts | |
- name: Build | |
run: npm run build -prod | |
- name: Deploy | |
run: rsync -chavzP --rsh="ssh -l deploy" build/* [email protected]:/var/ituk.ee/build | |
- name: Cleanup SSH keys | |
run: rm ~/.ssh/id_rsa |