Skip to content

Commit

Permalink
ci: hide hardcode paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Guilhermeasper committed Nov 23, 2023
1 parent 2b5ac4d commit 66e49b6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
20 changes: 14 additions & 6 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Node.js CI
name: Node.js CI/CD

on:
push:
Expand All @@ -14,17 +14,25 @@ jobs:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v3
- name: Checkout Repository
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build
- name: Install Dependencies and Build
run: |
npm ci
npm run build
deploy:
needs: build
runs-on: [self-hosted, Linux, X64]
steps:
- run: chmod +x ./deploy.sh
- run: echo ${{ secrets.DVNS_CLUSTER_PASSWORD }} | sudo -S ./deploy.sh
- name: Checkout Repository
uses: actions/checkout@v2
- name: Make deploy.sh executable
run: chmod +x ./deploy.sh
- name: Execute deploy.sh
run: echo "${{ secrets.DVNS_CLUSTER_PASSWORD }}" | sudo -S ./deploy.sh "$(pwd)/dist/" "${{ secrets.CERT_PATH }}"
17 changes: 8 additions & 9 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
#!/bin/bash

source /etc/marquinhos/marquinhos-api.conf
MARQUINHOS_PATH="/etc/marquinhos/"
source "${MARQUINHOS_PATH}marquinhos-api.conf"

CERTIFICATE_PATH="/home/guilherme/certificates/marquinhos/server.crt"
KEY_PATH="/home/guilherme/certificates/marquinhos/server.key"
DESTINATION_DIR="$1"

DESTINATION_DIR="/home/guilherme/github-runners/devaneios-runner/_work/marquinhos-web-api/marquinhos-web-api/dist"

cp "$CERTIFICATE_PATH" "$DESTINATION_DIR"
cp "$KEY_PATH" "$DESTINATION_DIR"
cp "${MARQUINHOS_PATH}server.crt" "$DESTINATION_DIR"
cp "${MARQUINHOS_PATH}server.key" "$DESTINATION_DIR"

chmod 744 "$DESTINATION_DIR/server.key"
chmod 744 "$DESTINATION_DIR/server.crt"
Expand All @@ -33,14 +31,15 @@ Environment="DISCORD_REDIRECT_URI=$DISCORD_REDIRECT_URI"
Environment="LASTFM_REDIRECT_URI=$LASTFM_REDIRECT_URI"
Environment="SPOTIFY_CLIENT_ID=$SPOTIFY_CLIENT_ID"
Environment="SPOTIFY_CLIENT_SECRET=$SPOTIFY_CLIENT_SECRET"
Environment="NODE_ENV=production"
User=guilherme
KillMode=control-group
WorkingDirectory=/home/guilherme/github-runners/devaneios-runner/_work/marquinhos-web-api/marquinhos-web-api/dist
WorkingDirectory=$DESTINATION_DIR
ExecStart=/home/guilherme/.nvm/versions/node/v18.13.0/bin/node ./index.js
ExecStart=node ./index.js
Restart=always
Expand Down

0 comments on commit 66e49b6

Please sign in to comment.