Skip to content

Commit

Permalink
upload bins to www on release (pkgxdev#209)
Browse files Browse the repository at this point in the history
* Behold my final form
* fix a couple of pre-existing but uncaught bugs
  • Loading branch information
jhheider authored Dec 2, 2022
1 parent f464541 commit 4a8e7a7
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ concurrency:

env:
VERBOSE: 1
TEA_SECRET: ${{ secrets.TEA_SECRET }}

jobs:
check:
Expand Down Expand Up @@ -91,14 +90,20 @@ jobs:
# because linux self-hosted image doesn’t have git
srcroot: ${{ github.workspace }}

- run: sed -i.bak "s/^const version = .*$/const version = \"{{ steps.tea.outputs.version }}\"/" src/app.ts
- run: sed -i.bak "s/^const version = .*$/const version = \"${{ steps.tea.outputs.version }}\"/" src/app.ts
- run: tea compile ./tea
- run: tar cJf tea-${{ steps.tea.outputs.version }}+${{ matrix.platform.build-id }}.tar.xz ./tea
- uses: actions/upload-artifact@v3
with:
name: tarballs
path: tea-${{ steps.tea.outputs.version }}+${{ matrix.platform.build-id }}.tar.xz
if-no-files-found: error
- run: mv ./tea tea-${{ matrix.platform.build-id }}
- uses: actions/upload-artifact@v3
with:
name: binaries
path: tea-${{ matrix.platform.build-id }}
if-no-files-found: error

bundle-src:
runs-on: ubuntu-latest
Expand All @@ -111,7 +116,7 @@ jobs:
id: tea
with:
srcroot: tea
- run: sed -i.bak "s/^const version = .*$/const version = \"{{ steps.tea.outputs.version }}\"/" src/app.ts
- run: sed -i.bak "s/^const version = .*$/const version = \"${{ steps.tea.outputs.version }}\"/" src/app.ts
working-directory: tea
- run: mv tea tea-${{ steps.tea.outputs.version }}
- run: tar cJf tea-${{ steps.tea.outputs.version }}.tar.xz ./tea-${{ steps.tea.outputs.version }}
Expand Down Expand Up @@ -145,3 +150,28 @@ jobs:
tag_name: ${{ env.TAG }}
files: artifacts/*
fail_on_unmatched_files: true

upload-binaries:
needs: [release]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: binaries
path: binaries
- name: AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Upload to S3
run: |
aws s3 sync binaries s3://www.tea.xyz/ \
--metadata-directive REPLACE \
--cache-control no-cache,must-revalidate
- name: Invalidate cache
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }} \
--paths /binaries/*

0 comments on commit 4a8e7a7

Please sign in to comment.