fix build error #137
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: Publish Docker image | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - 'workshop-ui/**' | |
| workflow_dispatch: | |
| jobs: | |
| tests: | |
| name: Run unit tests and publish reports | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| checks: write | |
| id-token: write | |
| steps: | |
| - name: Check out the repo | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| - name: Azure login | |
| uses: azure/login@v2 | |
| with: | |
| tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
| subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
| client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
| - &create_env | |
| name: Create .env file | |
| working-directory: workshop-ui | |
| run: | | |
| echo "SESSION_SECRET=${{ secrets.SESSION_SECRET }}" >> .env | |
| echo "STORAGE_ACCOUNT=${{ secrets.STORAGE_ACCOUNT }}" >> .env | |
| echo "APP_INSIGHTS_CONNECTION_STRING=${{ secrets.APP_INSIGHTS_CONNECTION_STRING }}" >> .env | |
| echo "LOG_EVENTS=${{ secrets.LOG_EVENTS }}" >> .env | |
| echo "OPENAI_MODEL=${{ secrets.OPENAI_MODEL }}" >> .env | |
| echo "AZURE_ENDPOINT=${{ secrets.AZURE_ENDPOINT }}" >> .env | |
| echo "AZURE_TENANT_ID=${{ secrets.AZURE_TENANT_ID }}" >> .env | |
| echo "AZURE_RESOURCE_GROUP=${{ secrets.AZURE_RESOURCE_GROUP }}" >> .env | |
| echo "AZURE_SESSION_POOL=${{ secrets.AZURE_SESSION_POOL }}" >> .env | |
| echo "AZURE_SESSION_POOL_ENDPOINT=${{ secrets.AZURE_SESSION_POOL_ENDPOINT }}" >> .env | |
| - name: Run Jest | |
| working-directory: workshop-ui | |
| run: | | |
| npm ci | |
| npm test -- --ci --coverage --reporters=default --reporters=jest-junit | |
| env: | |
| JEST_JUNIT_OUTPUT_DIR: "./reports/junit.xml" | |
| - name: Upload Jest Test Report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Jest Test Report | |
| path: workshop-ui/reports/junit.xml | |
| - name: Test Report | |
| if: always() | |
| uses: dorny/test-reporter@v2 | |
| with: | |
| artifact: Jest Test Report | |
| name: Jest Tests | |
| path: "*.xml" | |
| reporter: jest-junit | |
| fail-on-error: false | |
| push_to_registry: | |
| name: Push Docker image to Docker Hub | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| contents: read | |
| attestations: write | |
| id-token: write | |
| steps: | |
| - name: Check out the repo | |
| uses: actions/checkout@v4 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - *create_env | |
| - name: Build and push Docker image | |
| id: push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: workshop-ui | |
| push: true | |
| tags: rstropek/coderdojo-ai-workshop:latest | |
| - name: Generate artifact attestation | |
| uses: actions/attest-build-provenance@v2 | |
| with: | |
| subject-name: index.docker.io/rstropek/coderdojo-ai-workshop | |
| subject-digest: ${{ steps.push.outputs.digest }} | |
| push-to-registry: true |