code #76
This file contains 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: Build, Test, Deploy | |
on: | |
push: | |
branches: | |
- vite | |
- release/* | |
schedule: | |
- cron: "0 2 * * 1-5" | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
build-and-deploy: | |
name: Build & Deploy to Staging | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- name: Install Dependencies | |
run: npm install | |
working-directory: backned | |
- name: Build Project | |
run: npm run build --verbose | |
working-directory: backned | |
- name: Verify Build Output | |
run: ls -la backned/ | |
- name: Ensure dist exists | |
run: mkdir -p backned/dist | |
- name: Deploy Server in Background | |
run: nohup npm start > output.log 2>&1 & | |
working-directory: backned | |
- name: Check Deployment Logs | |
run: tail -n 20 output.log | |
working-directory: backned | |
github-pages-deploy: | |
name: Deploy to GitHub Pages | |
runs-on: ubuntu-latest | |
needs: build-and-deploy | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- name: Install Dependencies | |
run: npm install | |
working-directory: backned | |
- name: Build Project | |
run: npm run build --verbose | |
working-directory: backned | |
- name: Verify Build Output | |
run: ls -la backned/ | |
- name: Ensure dist exists | |
run: mkdir -p backned/dist | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Upload Artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: 'backned/dist' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |