Fix workflow server.js creation with proper echo syntax
This commit is contained in:
parent
97e119d15b
commit
f67c5202c9
1 changed files with 20 additions and 22 deletions
42
.github/workflows/int_poweron-nyla-int.yml
vendored
42
.github/workflows/int_poweron-nyla-int.yml
vendored
|
|
@ -31,28 +31,26 @@ jobs:
|
|||
- name: Create server.js for Azure
|
||||
run: |
|
||||
# Create ES module compatible server.js directly in root
|
||||
cat > server.js << 'EOF'
|
||||
import express from 'express';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
const app = express();
|
||||
|
||||
app.use(express.static(path.join(__dirname, 'dist')));
|
||||
|
||||
app.get('/*', function(req, res) {
|
||||
res.sendFile(path.join(__dirname, 'dist', 'index.html'));
|
||||
});
|
||||
|
||||
const port = process.env.PORT || 8080;
|
||||
app.listen(port, '0.0.0.0', () => {
|
||||
console.log(`Server running on port ${port}`);
|
||||
console.log(`Serving from: ${__dirname}/dist`);
|
||||
});
|
||||
EOF
|
||||
echo "import express from 'express';" > server.js
|
||||
echo "import path from 'path';" >> server.js
|
||||
echo "import { fileURLToPath } from 'url';" >> server.js
|
||||
echo "" >> server.js
|
||||
echo "const __filename = fileURLToPath(import.meta.url);" >> server.js
|
||||
echo "const __dirname = path.dirname(__filename);" >> server.js
|
||||
echo "" >> server.js
|
||||
echo "const app = express();" >> server.js
|
||||
echo "" >> server.js
|
||||
echo "app.use(express.static(path.join(__dirname, 'dist')));" >> server.js
|
||||
echo "" >> server.js
|
||||
echo "app.get('/*', function(req, res) {" >> server.js
|
||||
echo " res.sendFile(path.join(__dirname, 'dist', 'index.html'));" >> server.js
|
||||
echo "});" >> server.js
|
||||
echo "" >> server.js
|
||||
echo "const port = process.env.PORT || 8080;" >> server.js
|
||||
echo "app.listen(port, '0.0.0.0', () => {" >> server.js
|
||||
echo " console.log(\`Server running on port \${port}\`);" >> server.js
|
||||
echo " console.log(\`Serving from: \${__dirname}/dist\`);" >> server.js
|
||||
echo "});" >> server.js
|
||||
|
||||
# Verify the file was created
|
||||
echo "=== server.js content ==="
|
||||
|
|
|
|||
Loading…
Reference in a new issue