-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ae42610
commit 9f3514c
Showing
1 changed file
with
20 additions
and
31 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,33 @@ | ||
name: Deploy to ituk.ee | ||
name: Build and Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
deploy: | ||
build-and-deploy: | ||
runs-on: self-hosted | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '17' | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '17' | ||
- name: Install dependencies | ||
run: npm install --force | ||
|
||
- name: Install dependencies | ||
run: npm install --force | ||
|
||
- name: Decrypt private key | ||
uses: webfactory/ssh-agent@v0.4.0 | ||
with: | ||
ssh-private-key: ${{ secrets.DEPLOY_SSH_KEY }} | ||
ssh-keyname: deploy_rsa | ||
|
||
- name: Decrypt deploy key | ||
run: | | ||
openssl aes-256-cbc -K ${{ secrets.DEPLOY_KEY_K }} -iv ${{ secrets.DEPLOY_KEY_IV }} -in deploy_rsa.enc -out deploy_rsa -d | ||
chmod 600 deploy_rsa | ||
eval "$(ssh-agent -s)" | ||
ssh-add deploy_rsa | ||
- name: Build project | ||
run: npm run build -prod | ||
|
||
- name: Deploy to remote server | ||
uses: easingthemes/ssh-deploy@v2 | ||
with: | ||
ssh-private-key: ${{ secrets.DEPLOY_KEY }} | ||
args: -chavzP | ||
local-dir: _work/ituk.ee/* | ||
remote-dir: /var/ituk.ee/build | ||
ssh-host: ${{ secrets.SSH_HOST }} | ||
ssh-username: ${{ secrets.SSH_USERNAME }} | ||
|
||
- name: Build project | ||
run: npm run build | ||
- name: Deploy | ||
run: rsync -chavzP --rsh="ssh -l ${{ secrets.SSH_USERNAME }}" _work/ituk.ee/* ${{ secrets.SSH_USERNAME }}@ituk.ee:/var/ituk.ee/build |