1
name: "deploy / website"
13
group: "${{ github.event.workflow_run.head_repository.full_name }}-${{ github.event.workflow_run.head_branch }}-${{ github.workflow_ref }}"
14
cancel-in-progress: true
18
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
19
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
24
runs-on: ubuntu-latest
26
should_run: ${{ steps.changes.outputs.should_run }}
27
sha: ${{ steps.changes.outputs.sha }}
28
merge_sha: ${{ steps.changes.outputs.merge_sha }}
29
pr_number: ${{ steps.changes.outputs.pr_number }}
30
source_branch: ${{ steps.changes.outputs.source_branch }}
31
source_repo: ${{ steps.changes.outputs.source_repo }}
32
found_pr: ${{ steps.changes.outputs.found_pr }}
33
mergeable: ${{ steps.changes.outputs.mergeable }}
35
- uses: actions/checkout@v4
36
- uses: "gradio-app/gradio/.github/actions/changes@main"
40
token: ${{ secrets.GITHUB_TOKEN }}
44
uses: "./.github/workflows/comment-queue.yml"
46
gh_token: ${{ secrets.COMMENT_TOKEN }}
48
pr_number: ${{ needs.changes.outputs.pr_number }}
49
message: website~pending~null
51
name: "deploy-website"
52
runs-on: ubuntu-latest
54
if: needs.changes.outputs.should_run == 'true'
56
vercel_url: ${{ steps.output_url.outputs.vercel_url }}
58
- uses: actions/checkout@v4
60
ref: ${{ needs.changes.outputs.merge_sha }}
61
repository: ${{ needs.changes.outputs.mergeable == 'true' && github.repository || needs.changes.outputs.source_repo }}
62
- name: install dependencies
63
uses: "gradio-app/gradio/.github/actions/install-all-deps@main"
65
always_install_pnpm: true
67
- name: deploy json to aws
68
if: needs.changes.outputs.source_branch == 'changeset-release/main' && needs.changes.outputs.source_repo == 'gradio-app/gradio'
70
export AWS_ACCESS_KEY_ID=${{ secrets.AWSACCESSKEYID }}
71
export AWS_SECRET_ACCESS_KEY=${{ secrets.AWSSECRETKEY }}
72
export AWS_DEFAULT_REGION=us-west-2
73
version=$(jq -r .version js/_website/src/lib/json/version.json)
74
aws s3 cp ./js/_website/src/lib/json/ s3://gradio-docs-json/$version/ --recursive
75
- name: Install Vercel CLI
76
run: pnpm install --global vercel@latest
78
- name: Pull Vercel Environment Information
80
if: needs.changes.outputs.found_pr == 'true'
81
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
82
- name: Build Project Artifacts
83
if: needs.changes.outputs.found_pr == 'true'
85
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
86
- name: Deploy Project Artifacts to Vercel
87
if: needs.changes.outputs.found_pr == 'true'
90
run: echo "vercel_url=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }})" >> $GITHUB_OUTPUT
92
- name: Pull Vercel Environment Information
93
if: needs.changes.outputs.source_repo == 'gradio-app/gradio' && needs.changes.outputs.source_branch == 'main'
95
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
96
- name: Build Project Artifacts
97
if: needs.changes.outputs.source_repo == 'gradio-app/gradio' && needs.changes.outputs.source_branch == 'main'
99
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
100
- name: Deploy Project Artifacts to Vercel
101
if: needs.changes.outputs.source_repo == 'gradio-app/gradio' && needs.changes.outputs.source_branch == 'main'
103
run: echo "VERCEL_URL=$(vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }})" >> $GITHUB_ENV
106
comment-deploy-success:
107
uses: "./.github/workflows/comment-queue.yml"
108
needs: [deploy-website, changes]
109
if: needs.deploy-website.result == 'success' && needs.changes.outputs.found_pr == 'true'
111
gh_token: ${{ secrets.COMMENT_TOKEN }}
113
pr_number: ${{ needs.changes.outputs.pr_number }}
114
message: website~success~${{needs.deploy-website.outputs.vercel_url}}
115
comment-deploy-failure:
116
uses: "./.github/workflows/comment-queue.yml"
117
needs: [deploy-website, changes]
118
if: always() && needs.deploy-website.result == 'failure' && needs.changes.outputs.found_pr == 'true'
120
gh_token: ${{ secrets.COMMENT_TOKEN }}
122
pr_number: ${{ needs.changes.outputs.pr_number }}
123
message: website~failure~https://github.com/gradio-app/gradio/actions/runs/${{github.run_id}}/