Web #316
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: Web | |
| env: | |
| UV_FROZEN: 1 | |
| on: | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| inputs: | |
| experiment_name: | |
| description: Optional experiment name (to be used by experiment workflow) | |
| required: false | |
| type: string | |
| notify_team: | |
| description: "Notify team (if you want the whole team to check the run)" | |
| type: boolean | |
| default: false | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: astral-sh/setup-uv@v6 | |
| - run: uv sync | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: .tool-versions | |
| cache: 'npm' | |
| cache-dependency-path: '**/package-lock.json' | |
| - run: npm ci | |
| working-directory: frontend | |
| - run: npm run build | |
| working-directory: frontend | |
| - uses: actions/configure-pages@v5 | |
| - uses: actions/upload-pages-artifact@v3 | |
| id: deployment | |
| with: | |
| path: frontend/dist/ | |
| deploy: | |
| needs: build | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| outputs: | |
| page_url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| notify-team: | |
| needs: deploy | |
| if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.experiment_name != '' && !contains(inputs.notify_team, 'false')}} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: URL encode experiment name | |
| id: url-encode | |
| run: | | |
| ENCODED_NAME=$(echo -n ${{ toJSON(github.event.inputs.experiment_name) }} | jq -Rr @uri) | |
| echo "encoded_name=$ENCODED_NAME" >> $GITHUB_OUTPUT | |
| - name: Notifying the team about new report upload | |
| uses: slackapi/slack-github-action@v2.1.1 | |
| with: | |
| webhook: ${{ secrets.SLACK_NEW_MAAT_REPORT_WEBHOOK_URL }} | |
| webhook-type: webhook-trigger | |
| payload: | | |
| { | |
| "url": "${{ needs.deploy.outputs.page_url }}#s=${{ steps.url-encode.outputs.encoded_name }}&p=${{ steps.url-encode.outputs.encoded_name }}", | |
| "report_name": "${{ github.event.inputs.experiment_name }}" | |
| } |