fix bottle.yml:cleanup

This commit is contained in:
Jacob Heider 2023-01-03 18:18:49 -05:00
parent 5e5016d20d
commit 5e50f9ead7
No known key found for this signature in database
GPG key ID: A98011B5713535BF
2 changed files with 12 additions and 4 deletions

View file

@ -28,6 +28,7 @@ jobs:
outputs:
srcs: ${{ env.srcs }}
built: ${{ env.built }}
pr: ${{ env.PR }}
steps:
- uses: actions/checkout@v3
with:
@ -57,7 +58,7 @@ jobs:
name: ${{ matrix.platform.name }}
path: tea.xyz/var/pantry
- run: scripts/fetch-pr-artifacts.ts ${{ github.repository }} ${{ github.sha }} ${{ matrix.platform.name }}
- run: scripts/fetch-pr-artifacts.ts ${{ github.repository }} ${{ github.sha }} ${{ matrix.platform.name }} >>$GITHUB_ENV
if: ${{ !inputs.new-version }}
env:
GITHUB_TOKEN: ${{github.token}}
@ -231,8 +232,8 @@ jobs:
cleanup:
runs-on: ubuntu-latest
needs: [upload]
if: startsWith(github.ref, 'refs/pull/') && startsWith(github.repository, 'teaxyz/pantry.')
needs: [bottle, upload]
if: ${{ !inputs.new-version }}
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
@ -242,8 +243,13 @@ jobs:
aws-region: us-east-1
- run: |
REPO=$(echo ${{github.repository}} | sed -e 's_teaxyz/__')
PR=$(echo ${{github.ref}} | sed -e 's_refs/pull/\(.*\)/merge_\1_')
if test -z "$PR"; then
echo "no PR to clean up"
exit 0
fi
aws s3 rm --recursive s3://$AWS_S3_CACHE/pull-request/$REPO/$PR
env:
AWS_S3_CACHE: ${{ secrets.AWS_S3_CACHE }}
PR: ${{ needs.bottle.outputs.pr }}

View file

@ -42,6 +42,8 @@ const artifacts = (await bucket.getObject(key)) ?? panic("No artifacts found")
const file = await Deno.open("artifacts.tgz", { create: true, write: true })
await artifacts.body.pipeTo(file.writable)
Deno.stdout.write(new TextEncoder().encode(`PR=${pr}`))
/// Functions
/// -------------------------------------------------------------------------------