fix CF invalidate

matrices don't output stable or combined data, so we weren't invalidating everything we think we were.
This commit is contained in:
Jacob Heider 2023-12-22 10:25:43 -05:00 committed by Jacob Heider
parent f238471639
commit e582f2844f

View file

@ -115,8 +115,6 @@ jobs:
matrix: matrix:
compression: [xz, gz] compression: [xz, gz]
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs:
paths: ${{ steps.put.outputs.cf-paths }}
env: env:
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:
@ -173,6 +171,13 @@ jobs:
id: put id: put
if: ${{ ! inputs.dry-run }} if: ${{ ! inputs.dry-run }}
- name: invalidate cloudfront
run: aws cloudfront create-invalidation
--distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }}
--paths
${{ steps.put.outputs.cf-paths }}
if: ${{ ! inputs.dry-run }}
publish: publish:
name: publish ${{inputs.tinyname}} ${{ inputs.dry-run && '(dry-run)' }} name: publish ${{inputs.tinyname}} ${{ inputs.dry-run && '(dry-run)' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -191,7 +196,7 @@ jobs:
- name: generate versions.txt - name: generate versions.txt
run: | run: |
if ! aws s3 cp \ if ! aws s3 cp \
s3://${{ secrets.AWS_S3_BUCKET }}/${{ needs.build.outputs.project }}/${{ needs.build.outputs.platform }}/${{ needs.build.outputs.arch }}/versions.txt \ s3://${{ secrets.AWS_S3_BUCKET }}/$DIRNAME/versions.txt \
./remote-versions.txt; then ./remote-versions.txt; then
touch remote-versions.txt touch remote-versions.txt
fi fi
@ -200,9 +205,9 @@ jobs:
env: env:
SCRIPT: | SCRIPT: |
import SemVer, { compare } from "https://raw.githubusercontent.com/pkgxdev/libpkgx/main/src/utils/semver.ts" import SemVer, { compare } from "https://raw.githubusercontent.com/pkgxdev/libpkgx/main/src/utils/semver.ts"
const versions = Deno.readTextFileSync(Deno.args[0]).trim().split("\n").filter(x => x) const versions = new Set(Deno.readTextFileSync(Deno.args[0]).trim().split("\n").filter(x => x))
versions.push(Deno.args[1]) versions.add(Deno.args[1])
const out = versions.map(x => new SemVer(x)).sort(compare).join("\n") const out = [...versions].map(x => new SemVer(x)).sort(compare).join("\n")
await Deno.stdout.write(new TextEncoder().encode(out.trim())) await Deno.stdout.write(new TextEncoder().encode(out.trim()))
- name: s3 put - name: s3 put
@ -214,7 +219,6 @@ jobs:
--distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }} --distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }}
--paths --paths
/$DIRNAME/versions.txt /$DIRNAME/versions.txt
${{ needs.bottle.outputs.paths }}
if: ${{ ! inputs.dry-run }} if: ${{ ! inputs.dry-run }}
complain: complain: