From 7f8d0a374a9ac2e046f7695ac96f398905a4073a Mon Sep 17 00:00:00 2001 From: Matt Godbolt Date: Thu, 18 Feb 2021 17:14:50 -0600 Subject: [PATCH] Try and get web deploy --- .github/workflows/test-and-deploy.yml | 35 +++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml index a874a41c..02bd1c60 100644 --- a/.github/workflows/test-and-deploy.yml +++ b/.github/workflows/test-and-deploy.yml @@ -5,7 +5,6 @@ on: [ push ] jobs: build-and-test: runs-on: ubuntu-20.04 - steps: - uses: actions/checkout@v2 with: @@ -36,7 +35,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [macos-latest, windows-latest, ubuntu-20.04] + os: [ macos-latest, windows-latest, ubuntu-20.04 ] steps: - uses: actions/checkout@v2 - name: Use Node.js 12.x @@ -59,3 +58,35 @@ jobs: github_token: ${{ secrets.github_token }} # If the commit is tagged with a version (e.g. "v1.0.0"), release the app after building release: ${{ startsWith(github.ref, 'refs/tags/v') }} + + update-web: + needs: build-and-test + if: github.ref == 'refs/heads/master' + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - name: Use Node.js 12.x + uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: Get npm cache directory + id: npm-cache + run: | + echo "::set-output name=dir::$(npm config get cache)" + - uses: actions/cache@v1 + with: + path: ${{ steps.npm-cache.outputs.dir }} + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - name: Build distribution + run: | + make dist + - uses: jakejarvis/s3-sync-action@master + with: + args: --acl public-read --cache-control max-age=30 --metadata-directive REPLACE + env: + AWS_S3_BUCKET: s3://bbc.godbolt.org/ + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + SOURCE_DIR: 'out/dist'