Update int_poweron-nyla-int.yml
This commit is contained in:
parent
fe7157d055
commit
210d2521c1
1 changed files with 42 additions and 55 deletions
97
.github/workflows/int_poweron-nyla-int.yml
vendored
97
.github/workflows/int_poweron-nyla-int.yml
vendored
|
|
@ -1,75 +1,62 @@
|
||||||
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
|
name: Deploy React App to Azure Web App
|
||||||
# More GitHub Actions for Azure: https://github.com/Azure/actions
|
|
||||||
|
|
||||||
name: Build and deploy Node.js app to Azure Web App - poweron-nyla-int
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- int
|
- main # oder dein Branch
|
||||||
workflow_dispatch:
|
workflow_dispatch: # Ermöglicht manuelles Triggern
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build-and-deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
|
||||||
contents: read #This is required for actions/checkout
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set up Node.js version
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: '18.x'
|
node-version: '18'
|
||||||
|
cache: 'npm' # Aktiviert Caching für schnellere Builds
|
||||||
|
|
||||||
- name: npm install, build, and test
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
npm install
|
npm ci
|
||||||
npm run build --if-present
|
npm install express
|
||||||
npm run test --if-present
|
|
||||||
|
|
||||||
- name: Zip build output for deployment
|
- name: Build React app
|
||||||
run: zip -r release.zip dist
|
run: npm run build
|
||||||
|
|
||||||
|
- name: Prepare deployment package
|
||||||
- name: Upload artifact for deployment job
|
run: |
|
||||||
uses: actions/upload-artifact@v4
|
# Create deployment package with build files and necessary configs
|
||||||
with:
|
mkdir deploy
|
||||||
name: node-app
|
cp -r dist/* deploy/
|
||||||
path: release.zip
|
# Create a simple server.js for serving the app
|
||||||
|
echo "const express = require('express');" > deploy/server.js
|
||||||
deploy:
|
echo "const path = require('path');" >> deploy/server.js
|
||||||
runs-on: ubuntu-latest
|
echo "const app = express();" >> deploy/server.js
|
||||||
needs: build
|
echo "app.use(express.static(path.join(__dirname)));" >> deploy/server.js
|
||||||
environment:
|
echo "app.get('/*', function(req, res) { res.sendFile(path.join(__dirname, 'index.html')); });" >> deploy/server.js
|
||||||
name: 'Production'
|
echo "const port = process.env.PORT || 8080;" >> deploy/server.js
|
||||||
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
|
echo "app.listen(port, () => console.log('Server running on port', port));" >> deploy/server.js
|
||||||
permissions:
|
# Create a new package.json for deployment
|
||||||
id-token: write #This is required for requesting the JWT
|
echo '{
|
||||||
contents: read #This is required for actions/checkout
|
"name": "frontend",
|
||||||
|
"version": "1.0.0",
|
||||||
steps:
|
"private": true,
|
||||||
- name: Download artifact from build job
|
"scripts": {
|
||||||
uses: actions/download-artifact@v4
|
"start": "node server.js"
|
||||||
with:
|
},
|
||||||
name: node-app
|
"dependencies": {
|
||||||
|
"express": "^4.18.2"
|
||||||
- name: Unzip artifact for deployment
|
}
|
||||||
run: unzip release.zip
|
}' > deploy/package.json
|
||||||
|
|
||||||
- name: Login to Azure
|
|
||||||
uses: azure/login@v2
|
|
||||||
with:
|
|
||||||
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_6DD84FBFF4714B219CFB34DCFFCD5AB8 }}
|
|
||||||
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_F971FF000D07422C8DE63D80087B1699 }}
|
|
||||||
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_B5B74D4E312E4B0AB251704F387F2166 }}
|
|
||||||
|
|
||||||
- name: 'Deploy to Azure Web App'
|
- name: 'Deploy to Azure Web App'
|
||||||
id: deploy-to-webapp
|
|
||||||
uses: azure/webapps-deploy@v3
|
uses: azure/webapps-deploy@v3
|
||||||
with:
|
with:
|
||||||
app-name: 'poweron-nyla-int'
|
app-name: 'poweron-nyla'
|
||||||
slot-name: 'Production'
|
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_D6C9359A57C5448A8C0BFA2D4C4B2068 }}
|
||||||
package: .
|
package: ./deploy
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue