Added deploy action script

This commit is contained in:
Andris Reinman 2023-03-31 11:59:42 +03:00
parent c43559cc52
commit aebd9e74ec
No known key found for this signature in database
GPG key ID: DC6C83F4D584D364
2 changed files with 40 additions and 0 deletions

34
.github/workflows/deploy.yml vendored Normal file
View file

@ -0,0 +1,34 @@
on:
push:
branches:
- master
name: Deploy test instance
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_KEY }}
known_hosts: ${{ secrets.KNOWN_HOSTS }}
- name: Deploy to server
env:
TARGET_HOST_02: srv-04.srv.dev
NODE_ENV: production
SERVICE_NAME: wildduck
id: deploy
run: |
echo $GITHUB_SHA > commit.txt
npm install --omit=dev
tar czf /tmp/${SERVICE_NAME}.tar.gz --exclude .git .
scp -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" /tmp/${SERVICE_NAME}.tar.gz deploy@${TARGET_HOST_02}:
ssh -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" deploy@$TARGET_HOST_02 "/opt/deploy.sh ${SERVICE_NAME}"

6
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,6 @@
{
"yaml.schemas": {
"https://squidfunk.github.io/mkdocs-material/schema.json": "mkdocs.yml",
"https://json.schemastore.org/github-workflow.json": "file:///Users/andris/Projects/wildduck/.github/workflows/deploy.yml"
}
}