Merge pull request #54 from IT2810-H26/ops/persistent-graphql-backend #8
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: Validate and deploy frontend | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: project2-frontend-production | |
| cancel-in-progress: false | |
| jobs: | |
| validate-and-deploy: | |
| name: Validate and deploy main | |
| if: github.ref == 'refs/heads/main' | |
| runs-on: [self-hosted, linux, x64, t07-project-2] | |
| timeout-minutes: 20 | |
| defaults: | |
| run: | |
| working-directory: client | |
| steps: | |
| - name: Check out main commit | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: npm | |
| cache-dependency-path: client/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Check formatting | |
| run: npm run format:check | |
| - name: Run Oxlint | |
| run: npm run lint | |
| - name: Run tests | |
| run: npm run test | |
| - name: Build frontend | |
| run: npm run build | |
| - name: Deploy verified main | |
| working-directory: . | |
| run: sudo -n /usr/bin/systemctl start t07-project2-deploy.service | |
| - name: Verify deployed commit | |
| working-directory: . | |
| run: test "$(cat /var/www/t07-project2/current/.commit)" = "$GITHUB_SHA" |