Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
mxcl committed Dec 12, 2023
1 parent 02977ad commit ea96f47
Showing 1 changed file with 43 additions and 24 deletions.
67 changes: 43 additions & 24 deletions .github/workflows/pkg-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,27 @@ jobs:
container: ${{ fromJSON(inputs.test-container) }}
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
env:
PKGX_PANTRY_PATH: ${{ github.workspace }}
steps:
- uses: pkgxdev/setup@v2
- uses: actions/checkout@v4
- uses: pkgxdev/brewkit/download-build-artifact@v1
- uses: pkgxdev/brewkit/test@v1
with:
pkg: ${{ needs.build.outputs.pkg }}
env:
PKGX_PANTRY_PATH: ${{ github.workspace }}

bottle:
name: bottle (${{inputs.name}}+${{matrix.compression}})
needs: [build, test]
strategy:
matrix:
compression: [xz, gz]
runs-on: ubuntu-latest
outputs:
paths: ${{ steps.put.outputs.cf-paths }}
env:
PREFIX: ${{ needs.build.outputs.project }}/${{ needs.build.outputs.platform }}/${{ needs.build.outputs.arch }}/v${{ needs.build.outputs.version }}.tar.${{ matrix.compression }}
steps:
- uses: pkgxdev/setup@v2

Expand Down Expand Up @@ -146,7 +151,36 @@ jobs:
--local-user ${{ secrets.GPG_KEY_ID }}
${{ steps.bottle.outputs.filename }}

- name: versions.txt
- name: sha
run: pkgx
sha256sum
${{ steps.bottle.outputs.filename }} > ${{ steps.bottle.outputs.filename }}.sha256sum

- name: s3 put
run: |
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 }}.sha256sum $URL.sha256sum
echo "cf-paths=$PREFIX $PREFIX.asc $PREFIX.sha256sum" >> $GITHUB_OUTPUT
env:
URL: s3://${{ secrets.AWS_S3_BUCKET }}/${{ env.PREFIX }}
id: put
if: ${{ inputs.upload }}

versions:
runs-on: ubuntu-latest
needs: [bottle, build]
steps:
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
env:
DIRNAME: ${{ needs.build.outputs.project }}/${{ needs.build.outputs.platform }}/${{ needs.build.outputs.arch }}

- name: generate versions.txt
run: |
aws s3 cp \
s3://${{ secrets.AWS_S3_BUCKET }}/${{ needs.build.outputs.project }}/${{ needs.build.outputs.platform }}/${{ needs.build.outputs.arch }}/versions.txt \
Expand All @@ -161,29 +195,14 @@ jobs:
const out = versions.map(x => new SemVer(x)).sort(compare).join("\n")
await Deno.stdout.write(new TextEncoder().encode(out.trim()))
- name: sha
run: pkgx
sha256sum
${{ steps.bottle.outputs.filename }} > ${{ steps.bottle.outputs.filename }}.sha256sum

- run: |
aws s3 cp ${{ steps.bottle.outputs.filename }} $DIRNAME/$BASENAME
aws s3 cp ${{ steps.bottle.outputs.filename }}.asc $DIRNAME/$BASENAME.asc
aws s3 cp ${{ steps.bottle.outputs.filename }}.sha256sum $DIRNAME/$BASENAME.sha256sum
aws s3 cp versions.txt $DIRNAME/versions.txt
env:
DIRNAME: s3://${{ secrets.AWS_S3_BUCKET }}/${{ needs.build.outputs.project }}/${{ needs.build.outputs.platform }}/${{ needs.build.outputs.arch }}
BASENAME: v${{ needs.build.outputs.version }}.tar.${{ matrix.compression }}
- name: s3 put
run: aws s3 cp versions.txt s3://${{ secrets.AWS_S3_BUCKET }}/$DIRNAME/versions.txt
if: ${{ inputs.upload }}

- run: aws cloudfront create-invalidation
- name: invalidate cloudfront
run: aws cloudfront create-invalidation
--distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }}
--paths
$PREFIX/$BASENAME
$PREFIX/$BASENAME.asc
$PREFIX/$BASENAME.sha256sum
$PREFIX/versions.txt
env:
PREFIX: /${{ needs.build.outputs.project }}/${{ needs.build.outputs.platform }}/${{ needs.build.outputs.arch }}
BASENAME: v${{ needs.build.outputs.version }}.tar.${{ matrix.compression }}
/$DIRNAME/versions.txt
${{ needs.bottle.outputs.paths }}
if: ${{ inputs.upload }}

0 comments on commit ea96f47

Please sign in to comment.