Gravity #253
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: Gravity | |
| on: | |
| workflow_run: | |
| workflows: ["Build"] | |
| types: | |
| - completed | |
| jobs: | |
| gravity: | |
| name: Run Gravity | |
| runs-on: ubuntu-latest | |
| if: > | |
| github.event.workflow_run.conclusion == 'success' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: 'Download artifact' | |
| uses: actions/github-script@v6 | |
| with: | |
| script: | | |
| let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| run_id: context.payload.workflow_run.id, | |
| }); | |
| let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { | |
| return artifact.name == "artifacts" | |
| })[0]; | |
| let download = await github.rest.actions.downloadArtifact({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| artifact_id: matchArtifact.id, | |
| archive_format: 'zip', | |
| }); | |
| let fs = require('fs'); | |
| fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/artifacts.zip`, Buffer.from(download.data)); | |
| - name: 'Unzip artifact' | |
| run: unzip artifacts.zip -d artifacts | |
| - run: pnpm dlx @gravityci/cli "artifacts" # keep track of the sizes of both the .crate file as well as the binary | |
| env: | |
| GRAVITY_SHA: ${{ github.event.workflow_run.head_sha }} | |
| GRAVITY_PR_ID: ${{ github.event.workflow_run.event == 'pull_request' && github.event.pull_request.id || '' }} | |
| GRAVITY_TOKEN: ${{ secrets.GRAVITY_TOKEN }} |