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: outputs:
srcs: ${{ env.srcs }} srcs: ${{ env.srcs }}
built: ${{ env.built }} built: ${{ env.built }}
pr: ${{ env.PR }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
@ -57,7 +58,7 @@ jobs:
name: ${{ matrix.platform.name }} name: ${{ matrix.platform.name }}
path: tea.xyz/var/pantry 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 }} if: ${{ !inputs.new-version }}
env: env:
GITHUB_TOKEN: ${{github.token}} GITHUB_TOKEN: ${{github.token}}
@ -231,8 +232,8 @@ jobs:
cleanup: cleanup:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [upload] needs: [bottle, upload]
if: startsWith(github.ref, 'refs/pull/') && startsWith(github.repository, 'teaxyz/pantry.') if: ${{ !inputs.new-version }}
steps: steps:
- name: Configure AWS Credentials - name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1 uses: aws-actions/configure-aws-credentials@v1
@ -242,8 +243,13 @@ jobs:
aws-region: us-east-1 aws-region: us-east-1
- run: | - run: |
REPO=$(echo ${{github.repository}} | sed -e 's_teaxyz/__') 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 aws s3 rm --recursive s3://$AWS_S3_CACHE/pull-request/$REPO/$PR
env: env:
AWS_S3_CACHE: ${{ secrets.AWS_S3_CACHE }} 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 }) const file = await Deno.open("artifacts.tgz", { create: true, write: true })
await artifacts.body.pipeTo(file.writable) await artifacts.body.pipeTo(file.writable)
Deno.stdout.write(new TextEncoder().encode(`PR=${pr}`))
/// Functions /// Functions
/// ------------------------------------------------------------------------------- /// -------------------------------------------------------------------------------