mirror of
https://github.com/ivabus/pantry
synced 2024-11-26 18:25:08 +03:00
finish has-artifacts
This commit is contained in:
parent
6d48c72aca
commit
a9b25a4c76
3 changed files with 43 additions and 32 deletions
46
.github/actions/has-artifacts/action.yml
vendored
46
.github/actions/has-artifacts/action.yml
vendored
|
@ -1,25 +1,30 @@
|
|||
name: tea/pantry/has-artifacts
|
||||
description: Outputs the platform spec we need for builds
|
||||
description: Determines if PR artifacts exist for a given SHA
|
||||
|
||||
inputs:
|
||||
platform:
|
||||
description: >
|
||||
The platform+arch to get specs for
|
||||
repo:
|
||||
description: The repo to check for artifacts
|
||||
required: true
|
||||
sha:
|
||||
description: The SHA to check for artifacts
|
||||
required: true
|
||||
token:
|
||||
description: The GitHub token to use
|
||||
required: true
|
||||
s3-bucket:
|
||||
description: The S3 bucket to use
|
||||
required: true
|
||||
aws-access-key-id:
|
||||
description: The AWS access key ID to use
|
||||
required: true
|
||||
aws-secret-access-key:
|
||||
description: The AWS secret access key to use
|
||||
required: true
|
||||
|
||||
outputs:
|
||||
os:
|
||||
description: the OS for general tasks
|
||||
value: ${{ steps.platform.outputs.os }}
|
||||
build-os:
|
||||
description: the OS for build tasks
|
||||
value: ${{ steps.platform.outputs.build-os }}
|
||||
container:
|
||||
description: the container for build tasks
|
||||
value: ${{ steps.platform.outputs.container }}
|
||||
test-matrix:
|
||||
description: the matrix of os/containers for test tasks
|
||||
value: ${{ steps.platform.outputs.test-matrix }}
|
||||
has-artifacts:
|
||||
description: whether there is a PR associated with that SHA with artifacts in staging
|
||||
value: ${{ steps.has-artifacts.outputs.has-artifacts }}
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
|
@ -32,8 +37,11 @@ runs:
|
|||
with:
|
||||
cache-name: has-artifacts
|
||||
|
||||
- run: ${{github.action_path}}/get-platform.ts
|
||||
- run: ${{github.action_path}}/has-artifacts.ts ${{ inputs.REPO }} ${{ inputs.SHA }} >>$GITHUB_OUTPUT
|
||||
shell: sh
|
||||
id: platform
|
||||
id: has-artifacts
|
||||
env:
|
||||
PLATFORM: ${{ inputs.platform }}
|
||||
GITHUB_TOKEN: ${{ inputs.token }}
|
||||
AWS_S3_CACHE: ${{ inputs.s3-bucket }}
|
||||
AWS_ACCESS_KEY_ID: ${{ inputs.aws-access-key-id }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ inputs.aws-secret-access-key }}
|
||||
|
|
|
@ -26,7 +26,7 @@ if (import.meta.main) {
|
|||
const pr = await find_pr(repo, ref)
|
||||
|
||||
if (!pr) {
|
||||
Deno.stdout.write(new TextEncoder().encode("HAS_ARTIFACTS=false"))
|
||||
Deno.stdout.write(new TextEncoder().encode("has-artifacts=false"))
|
||||
Deno.exit(0)
|
||||
}
|
||||
|
||||
|
@ -41,5 +41,5 @@ if (import.meta.main) {
|
|||
|
||||
const hasArtifacts = (objects?.contents?.length || 0) > 0
|
||||
|
||||
Deno.stdout.write(new TextEncoder().encode(`HAS_ARTIFACTS=${hasArtifacts ? "true" : "false"}`))
|
||||
Deno.stdout.write(new TextEncoder().encode(`has-artifacts=${hasArtifacts ? "true" : "false"}`))
|
||||
}
|
||||
|
|
25
.github/workflows/cd.yml
vendored
25
.github/workflows/cd.yml
vendored
|
@ -8,7 +8,7 @@ jobs:
|
|||
cd:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
HAS_ARTIFACTS: ${{ env.HAS_ARTIFACTS }}
|
||||
has-artifacts: ${{ steps.has-artifacts.outputs.has-artifacts }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
|
@ -16,17 +16,20 @@ jobs:
|
|||
|
||||
- uses: teaxyz/pantry.core/.github/actions/setup-brewkit@main
|
||||
|
||||
- run: scripts/map-projects-to-githubs.ts
|
||||
- run: .github/scripts/map-projects-to-githubs.ts
|
||||
env:
|
||||
WATCHER_URL: ${{ secrets.WATCHER_URL }}
|
||||
TEA_API_TOKEN: ${{ secrets.TEA_API_TOKEN }}
|
||||
|
||||
- run: scripts/has-artifacts.ts ${{ github.repository }} ${{ github.sha }} >>$GITHUB_ENV
|
||||
env:
|
||||
GITHUB_TOKEN: ${{github.token}}
|
||||
AWS_S3_CACHE: ${{ secrets.AWS_S3_CACHE }}
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
- uses: teaxyz/pantry.core/.github/actions/has-artifacts@main
|
||||
id: has-artifacts
|
||||
with:
|
||||
repo: ${{ github.repository }}
|
||||
sha: ${{ github.sha }}
|
||||
token: ${{github.token}}
|
||||
s3-bucket: ${{ secrets.AWS_S3_CACHE }}
|
||||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
|
||||
bottle-pr:
|
||||
strategy:
|
||||
|
@ -38,7 +41,7 @@ jobs:
|
|||
- darwin+aarch64
|
||||
- linux+aarch64
|
||||
needs: [cd]
|
||||
if: ${{ needs.cd.outputs.HAS_ARTIFACTS == 'true' }}
|
||||
if: ${{ needs.cd.outputs.has-artifacts == 'true' }}
|
||||
uses: ./.github/workflows/bottle.yml
|
||||
with:
|
||||
platform: ${{ matrix.platform }}
|
||||
|
@ -47,7 +50,7 @@ jobs:
|
|||
cleanup:
|
||||
needs: [bottle-pr]
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ needs.cd.outputs.HAS_ARTIFACTS == 'true' }}
|
||||
if: ${{ needs.cd.outputs.has-artifacts == 'true' }}
|
||||
env:
|
||||
PR: ${{ needs.bottle.outputs.pr }}
|
||||
steps:
|
||||
|
@ -73,7 +76,7 @@ jobs:
|
|||
bottle-standalone:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [cd]
|
||||
if: ${{ needs.cd.outputs.HAS_ARTIFACTS == 'false' }}
|
||||
if: ${{ needs.cd.outputs.has-artifacts == 'false' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: technote-space/get-diff-action@v6
|
||||
|
|
Loading…
Reference in a new issue