Fix QA workflow to post detailed test results table as PR comments wi… #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 Web App to GitHub Pages | |
| on: | |
| push: | |
| branches: [ main, copilot/fix-1 ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build core library | |
| run: npm run build --workspace=packages/fmlrunner | |
| - name: Build web application | |
| run: npm run build --workspace=packages/fmlrunner-web | |
| - name: Copy OpenAPI specification | |
| run: | | |
| mkdir -p packages/fmlrunner-web/dist | |
| cp packages/fmlrunner-rest/openapi.yaml packages/fmlrunner-web/dist/ | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: 'packages/fmlrunner-web/dist' | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/copilot/fix-1' | |
| # Cleanup previous deployments (squash commits) | |
| cleanup: | |
| runs-on: ubuntu-latest | |
| needs: build-and-deploy | |
| if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/copilot/fix-1' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Force update gh-pages branch | |
| run: | | |
| # Configure git | |
| git config --global user.name 'github-actions[bot]' | |
| git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
| # Create/update gh-pages branch with squashed commit | |
| git checkout --orphan gh-pages-temp | |
| git rm -rf . || true | |
| echo "# FML Runner Web App" > README.md | |
| echo "This branch contains the deployed web application." >> README.md | |
| echo "Visit the live app at: https://litlfred.github.io/fmlrunner/" >> README.md | |
| git add README.md | |
| git commit -m "Deploy FML Runner web app - $(date -u +"%Y-%m-%d %H:%M:%S UTC")" | |
| # Force push to gh-pages (this replaces all history) | |
| git push origin gh-pages-temp:gh-pages --force | |
| # Cleanup | |
| git checkout main | |
| git branch -D gh-pages-temp |