Merge branch 'main' of https://github.com/netwrix/docs #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy to Azure App Service | |
| on: | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| env: | |
| AZURE_WEBAPP_NAME: static-docs-site | |
| NODE_VERSION: '20.x' | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| # Cache Docusaurus build artifacts | |
| - name: Cache Docusaurus build folder | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| .docusaurus | |
| node_modules/.cache | |
| key: ${{ runner.os }}-docusaurus-${{ hashFiles('docs/**/*.md', 'docs/**/*.mdx', 'sidebars/**/*.js', 'docusaurus.config.js', 'package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-docusaurus- | |
| # Cache build output for unchanged content | |
| - name: Cache build output | |
| uses: actions/cache@v4 | |
| with: | |
| path: build | |
| key: ${{ runner.os }}-build-${{ hashFiles('docs/**', 'sidebars/**', 'src/**', 'static/**', 'docusaurus.config.js', 'package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-build- | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build application | |
| run: | | |
| echo "Building Docusaurus site..." | |
| echo "Docusaurus will use cached artifacts when possible to speed up the build." | |
| npm run build | |
| echo "Build completed!" | |
| - name: Prepare deployment package | |
| run: | | |
| # Create a minimal package.json for production | |
| echo '{ | |
| "name": "docs-static", | |
| "version": "1.0.0", | |
| "private": true, | |
| "dependencies": { | |
| "serve": "^14.2.0" | |
| } | |
| }' > build/package.json | |
| # Create deployment archive | |
| cd build | |
| zip -r ../deploy.zip . | |
| - name: Deploy to Azure Web App | |
| uses: azure/webapps-deploy@v2 | |
| with: | |
| app-name: ${{ env.AZURE_WEBAPP_NAME }} | |
| publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} | |
| package: deploy.zip | |
| # This is already configured and stays between deployments: | |
| # startup-file: "npx serve build -p 8080" |