Workflow CI #4105
This file contains 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: Workflow CI | |
on: | |
workflow_run: | |
workflows: | |
- "Pull Request CI" | |
types: | |
- completed | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
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 }} | |
--> |