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 91533dd
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
21 changes: 15 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,26 @@ 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 }}"
Empty file added README.md
Empty file.
15 changes: 7 additions & 8 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@

source /etc/marquinhos/marquinhos-api.conf

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

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 "($CERT_PATH)server.crt" "$DESTINATION_DIR"
cp "($CERT_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 91533dd

Please sign in to comment.