From 201fe7e14a10082497fb584c6bfc8b7e83ca9e83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Zieli=C5=84ski?= Date: Wed, 12 Feb 2025 18:51:37 +0100 Subject: [PATCH] WIP: Build & Release --- .github/workflows/buildScripts/replaceTokens.js | 11 +++-------- .github/workflows/release-morska.yml | 11 +++++++++++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/buildScripts/replaceTokens.js b/.github/workflows/buildScripts/replaceTokens.js index bb993f8..bf131a7 100644 --- a/.github/workflows/buildScripts/replaceTokens.js +++ b/.github/workflows/buildScripts/replaceTokens.js @@ -1,5 +1,5 @@ module.exports = async ({ github, context, core, jobId }) => { - /* + const frontendPath = `./${jobId}/frontend/diunaBI/browser/`; const files = (require('fs').readdirSync(frontendPath).filter(file => file.endsWith('.js'))) .map(file => `${frontendPath}${file}`); @@ -7,11 +7,9 @@ module.exports = async ({ github, context, core, jobId }) => { core.setFailed("Frontend JS files not found"); return false; } - */ - - const files = []; + files.push(`./${jobId}/webapi/appsettings.json`); - //files.push(`./${jobId}/webapi/client_secrets.json`); + files.push(`./${jobId}/webapi/client_secrets.json`); files.forEach(file => { let data = require('fs').readFileSync(file, 'utf8'); @@ -26,10 +24,7 @@ module.exports = async ({ github, context, core, jobId }) => { return false; } data = data.replace(new RegExp(original, 'g'), value); - console.log(`Replaced ${original} with ${value} (${token}) in ${file}`); - console.log(data); } - console.log(data); require('fs').writeFileSync(file, data, 'utf8'); }); } diff --git a/.github/workflows/release-morska.yml b/.github/workflows/release-morska.yml index a4df05a..703c7ef 100644 --- a/.github/workflows/release-morska.yml +++ b/.github/workflows/release-morska.yml @@ -96,3 +96,14 @@ jobs: chmod 600 private_key scp -i private_key -o StrictHostKeyChecking=no ./${{env.job_id}}/morska-webapi.zip mz@crm.bim-it.pl: rm private_key + + - name: Run SSH commands on remote server + env: + SSH_PRIVATE_KEY: ${{ secrets.PROD_SRV_PRIVATE_KEY }} + run: | + echo "${SSH_PRIVATE_KEY}" > private_key + chmod 600 private_key + ssh -i private_key -o StrictHostKeyChecking=no mz@crm.bim-it.pl << 'EOF' + ./deploy.sh + EOF + rm private_key \ No newline at end of file