Skip to content

Commit

Permalink
ci: create the deploy endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
benhuangbmj committed Jan 13, 2024
1 parent fe8b32c commit b82a9cd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/github-actions-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ jobs:
Deploy-the-current-version:
runs-on: ubuntu-latest
steps:
- run: echo 'Hello World!'
- run: curl https://54.159.195.25:3000/deploy
13 changes: 13 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const { Server } = require("socket.io");
const bodyParser = require("body-parser");
const cookieParser = require("cookie-parser");
const sqlite3 = require("sqlite3").verbose();
const { exec } = require('node:child_process')

const { selectAll } = require("./databases/utilities/selectAll");
const { createTask } = require("./databases/utilities/createTask");
Expand Down Expand Up @@ -122,6 +123,18 @@ app.get("/supervisees", async (req, res) => {
res.json(supervisees);
});

app.get('/deploy', (req, res) => {
console.log('deploy!');
exec('git pull', (err, output) => {
if(err) {
console.log(err);
} else {
console.log(output);
}
})
res.end();
})

app.get("/", (req, res) => {
const message = `<p style="color: green; width: fit-content; margin: auto; text-align: center">
Backend Lab
Expand Down

0 comments on commit b82a9cd

Please sign in to comment.