Repository navigation
feat: add sparring training loop #176
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: Build and Push Docker Image | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| env: | |
| DOCKER_PUSH: ${{ github.event_name == 'push' && secrets.DOCKER_USERNAME != '' && secrets.DOCKER_PASSWORD != '' }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Node | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 | |
| with: | |
| node-version: 22 | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Install Playwright Chromium | |
| run: npx playwright install --with-deps chromium | |
| - name: Verify | |
| run: npm run verify | |
| - name: Upload browser failure evidence | |
| if: failure() | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: playwright-failure-evidence-${{ github.run_id }} | |
| path: | | |
| test-results | |
| playwright-report | |
| if-no-files-found: ignore | |
| retention-days: 7 | |
| - name: Set up QEMU | |
| if: env.DOCKER_PUSH == 'true' | |
| uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3 | |
| - name: Set up Docker Buildx | |
| if: env.DOCKER_PUSH == 'true' | |
| uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3 | |
| - name: Login to Docker Hub | |
| if: env.DOCKER_PUSH == 'true' | |
| uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| # Create a minimal Dockerfile for multi-arch that just uses pre-built assets | |
| - name: Create production Dockerfile | |
| if: env.DOCKER_PUSH == 'true' | |
| run: | | |
| cat > Dockerfile.prod << 'EOF' | |
| FROM nginx:alpine | |
| RUN rm -rf /usr/share/nginx/html/* | |
| COPY dist /usr/share/nginx/html | |
| COPY nginx.conf /etc/nginx/conf.d/default.conf | |
| EXPOSE 80 | |
| CMD ["nginx", "-g", "daemon off;"] | |
| EOF | |
| - name: Build and push | |
| if: env.DOCKER_PUSH == 'true' | |
| uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5 | |
| with: | |
| context: . | |
| file: Dockerfile.prod | |
| push: ${{ env.DOCKER_PUSH == 'true' }} | |
| tags: adamgaborjaniszabo/debate-trainer:latest | |
| platforms: linux/amd64,linux/arm64 |