upload file listing

This commit is contained in:
Max Howell 2024-02-02 16:32:34 -05:00
parent a6edc9f2fa
commit 9e68207e53

View file

@ -125,6 +125,7 @@ jobs:
compression: [xz, gz] compression: [xz, gz]
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
AWS: ${{ inputs.dry-run && 'echo' || 'aws' }}
PREFIX: ${{ needs.build.outputs.project }}/${{ needs.build.outputs.platform }}/${{ needs.build.outputs.arch }}/v${{ needs.build.outputs.version }}.tar.${{ matrix.compression }} PREFIX: ${{ needs.build.outputs.project }}/${{ needs.build.outputs.platform }}/${{ needs.build.outputs.arch }}/v${{ needs.build.outputs.version }}.tar.${{ matrix.compression }}
steps: steps:
- uses: pkgxdev/setup@v2 - uses: pkgxdev/setup@v2
@ -170,22 +171,35 @@ jobs:
- name: s3 put - name: s3 put
run: | run: |
aws s3 cp ${{ steps.bottle.outputs.filename }} $URL $AWS s3 cp ${{ steps.bottle.outputs.filename }} $URL
aws s3 cp ${{ steps.bottle.outputs.filename }}.asc $URL.asc $AWS s3 cp ${{ steps.bottle.outputs.filename }}.asc $URL.asc
aws s3 cp ${{ steps.bottle.outputs.filename }}.sha256sum $URL.sha256sum $AWS s3 cp ${{ steps.bottle.outputs.filename }}.sha256sum $URL.sha256sum
echo "cf-paths=/$PREFIX /$PREFIX.asc /$PREFIX.sha256sum" >> $GITHUB_OUTPUT echo "cf-paths=/$PREFIX /$PREFIX.asc /$PREFIX.sha256sum" >> $GITHUB_OUTPUT
env: env:
URL: s3://${{ secrets.AWS_S3_BUCKET }}/${{ env.PREFIX }} URL: s3://${{ secrets.AWS_S3_BUCKET }}/${{ env.PREFIX }}
id: put id: put
if: inputs.dry-run != true
- name: s3 put file listing
if: ${{ matrix.compression == 'gz' }}
id: files
run: |
PREFIX=$(dirname $PREFIX)
tar tf ${{ steps.bottle.outputs.filename }} \
| grep -v '/$' \
| grep -v '^venv/' \
> $FILENAME
$AWS s3 cp $FILENAME s3://${{ secrets.AWS_S3_BUCKET }}/$PREFIX/$FILENAME
echo "cf-paths=/$PREFIX/$FILENAME" >> $GITHUB_OUTPUT
env:
FILENAME: v${{ needs.build.outputs.version }}.files.txt
- name: invalidate cloudfront - name: invalidate cloudfront
run: aws cloudfront create-invalidation run: $AWS cloudfront create-invalidation
--distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }} --distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }}
--paths --paths
${{ steps.put.outputs.cf-paths }} ${{ steps.put.outputs.cf-paths }} ${{ steps.files.outputs.cf-paths }}
if: inputs.invalidate-cloudfront && !inputs.dry-run if: inputs.invalidate-cloudfront
publish: publish:
name: publish ${{inputs.tinyname}} ${{ inputs.dry-run && '(dry-run)' }} name: publish ${{inputs.tinyname}} ${{ inputs.dry-run && '(dry-run)' }}
@ -193,6 +207,7 @@ jobs:
needs: [bottle, build] needs: [bottle, build]
permissions: {} permissions: {}
env: env:
AWS: ${{ inputs.dry-run && 'echo' || 'aws' }}
DIRNAME: ${{ needs.build.outputs.project }}/${{ needs.build.outputs.platform }}/${{ needs.build.outputs.arch }} DIRNAME: ${{ needs.build.outputs.project }}/${{ needs.build.outputs.platform }}/${{ needs.build.outputs.arch }}
steps: steps:
- uses: aws-actions/configure-aws-credentials@v4 - uses: aws-actions/configure-aws-credentials@v4
@ -221,15 +236,14 @@ jobs:
await Deno.stdout.write(new TextEncoder().encode(out.trim())) await Deno.stdout.write(new TextEncoder().encode(out.trim()))
- name: s3 put - name: s3 put
run: aws s3 cp versions.txt s3://${{ secrets.AWS_S3_BUCKET }}/$DIRNAME/versions.txt run: $AWS s3 cp versions.txt s3://${{ secrets.AWS_S3_BUCKET }}/$DIRNAME/versions.txt
if: inputs.dry-run != true
- name: invalidate cloudfront - name: invalidate cloudfront
run: aws cloudfront create-invalidation run: $AWS cloudfront create-invalidation
--distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }} --distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }}
--paths --paths
/$DIRNAME/versions.txt /$DIRNAME/versions.txt
if: inputs.invalidate-cloudfront && !inputs.dry-run if: inputs.invalidate-cloudfront
complain: complain:
needs: bottle needs: bottle