blob: 0d475a269e7b377ff37796dc279fa38fa19c37ae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
name: Workflow CI
on:
workflow_run:
workflows:
- "Pull Request CI"
types:
- completed
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.1
with:
persist-credentials: false
- run: |
PR=$(curl https://api.github.com/search/issues?q=${{ github.event.workflow_run.head_sha }} |
grep -Po "(?<=${{ github.event.workflow_run.repository.full_name }}\/pulls\/)\d*" | head -1)
echo "PR=$PR" >> $GITHUB_ENV
- uses: actions/github-script@v3
id: pr-artifact
with:
github-token: ${{secrets.GITHUB_TOKEN}}
result-encoding: string
script: |
const artifacts_url = context.payload.workflow_run.artifacts_url
const artifacts_req = await github.request(artifacts_url)
const artifact = artifacts_req.data.artifacts[0]
const download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: artifact.id,
archive_format: "zip"
})
return download.url
- run: |
rm -rf *
curl -L -o "pr-artifact.zip" "${{ steps.pr-artifact.outputs.result }}"
unzip -o pr-artifact.zip
rm pr-artifact.zip
- run: |
cat << EOF >> firebase.json
{
"hosting": {
"public": ".",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
}
EOF
cat << EOF >> .firebaserc
{
"projects": {
"default": "gpuweb-cts"
}
}
EOF
- id: deployment
continue-on-error: true
uses: FirebaseExtended/action-hosting-deploy@v0
with:
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_CTS }}
expires: 10d
channelId: cts-prs-${{ env.PR }}-${{ github.event.workflow_run.head_sha }}
- uses: peter-evans/create-or-update-comment@v1
continue-on-error: true
if: ${{ steps.deployment.outcome == 'success' }}
with:
issue-number: ${{ env.PR }}
body: |
Previews, as seen when this [build job](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}) started (${{ github.event.workflow_run.head_sha }}):
[**Run tests**](${{ steps.deployment.outputs.details_url }}/standalone/) | [**View tsdoc**](${{ steps.deployment.outputs.details_url }}/docs/tsdoc/)
<!--
pr;head;sha
${{ env.PR }};${{ github.event.workflow_run.head_repository.full_name }};${{ github.event.workflow_run.head_sha }}
-->
|