v1.2.0c - Migrate package management from pnpm to npm, update depende… #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
| # Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy | |
| # More GitHub Actions for Azure: https://github.com/Azure/actions | |
| name: Build and deploy - BasaltCMS | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read #This is required for actions/checkout | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node.js version | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: "24.x" | |
| cache: "npm" | |
| - name: Next.js cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ${{ github.workspace }}/.next/cache | |
| key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} | |
| restore-keys: | | |
| ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- | |
| - name: npm install, build, and test | |
| env: | |
| DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
| GOOGLE_ID: ${{ secrets.GOOGLE_ID }} | |
| GOOGLE_SECRET: ${{ secrets.GOOGLE_SECRET }} | |
| run: | | |
| npm install | |
| npx prisma generate | |
| npm run build --if-present | |
| npm run test --if-present | |
| - name: Prepare Standalone Build | |
| run: | | |
| cp -r public .next/standalone/public | |
| mkdir -p .next/standalone/.next | |
| cp -r .next/static .next/standalone/.next/static | |
| # Ensure start command is correct for Azure Service Plan | |
| cd .next/standalone | |
| npm pkg set scripts.start="node server.js" | |
| cd ../.. | |
| # Debug: Verify .next/standalone/.next exists and has content | |
| ls -la .next/standalone/.next | |
| # Zip the standalone directory to preserve all files including hidden ones | |
| cd .next/standalone | |
| zip -r ../../release.zip . | |
| cd ../.. | |
| - name: Upload artifact for deployment job | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: node-app | |
| path: release.zip | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Download artifact from build job | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: node-app | |
| - name: Unzip artifact | |
| run: | | |
| unzip release.zip -d ./deploy | |
| - name: "Deploy to Azure Web App" | |
| id: deploy-to-webapp | |
| uses: azure/webapps-deploy@v3 | |
| with: | |
| app-name: "basalt-cms" | |
| slot-name: "Production" | |
| package: ./deploy | |
| publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_10465936071D4A7AA627DEB04C65156B }} |