diff options
-rw-r--r-- | .github/workflows/build-and-test.yml | 70 | ||||
-rw-r--r-- | .github/workflows/build-docs.yml | 2 |
2 files changed, 68 insertions, 4 deletions
diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 4be09d56..4f8f4526 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -3,7 +3,7 @@ name: Test builds on: push jobs: - frontend: + test-frontend: name: Test build frontend runs-on: ubuntu-latest @@ -23,8 +23,9 @@ jobs: with: # npm cache files are stored in `~/.npm` on Linux/macOS path: ~/.npm - key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} + key: ${{ runner.OS }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }} restore-keys: | + ${{ runner.OS }}-node-${{ matrix.node-version }} ${{ runner.OS }}-node- ${{ runner.OS }}- @@ -43,6 +44,68 @@ jobs: - name: Test front run: npm run unit working-directory: front + + - name: Test build front + run: npm run build + working-directory: front + + sync-frontend: + name: Sync frontend release + runs-on: ubuntu-latest + + needs: test-frontend + if: github.ref == 'refs/heads/master' || (github.event_name == 'push' && contains(github.ref, 'refs/tags/')) + + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Uses Node.JS 14.x + uses: actions/setup-node@v1 + with: + node-version: 14.x + - name: Cache Node.js modules + uses: actions/cache@v2 + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.OS }}-node-14.x-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.OS }}-node-14.x + ${{ runner.OS }}-node- + ${{ runner.OS }}- + + - name: Install dependencies + run: | + yarn install --frozen-lockfile + working-directory: front + + - name: Build front + run: npm run build + working-directory: front + + - name: Archive build (tag) + run: | + export NAME="front-dist-${{ github.event.release.tag_name }}" + zip -r "${NAME}.zip" dist/ + working-directory: front + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') + + - name: Archive build (master) + run: | + export NAME="front-dist-master" + zip -r "${NAME}.zip" dist/ + working-directory: front + if: github.ref == 'refs/heads/master' + + - name: Deploy front + uses: burnett01/rsync-deployments@4.1 + with: + switches: -avc + path: front-dist-*.zip + remote_path: / + remote_host: ${{ secrets.ASSETS_DEPLOY_HOST }} + remote_user: ${{ secrets.ASSETS_DEPLOY_USER }} + remote_key: ${{ secrets.ASSETS_DEPLOY_KEY }} backend: name: Test build backend @@ -80,8 +143,9 @@ jobs: # This path is specific to Ubuntu path: ~/.cache/pip # Look to see if there is a cache hit for the corresponding requirements file - key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} + key: ${{ runner.os }}-pip-${{ matrix.python }}-${{ hashFiles('requirements.txt') }} restore-keys: | + ${{ runner.os }}-pip-${{ matrix.python }} ${{ runner.os }}-pip- ${{ runner.os }}- diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 76243948..49227eaf 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -35,4 +35,4 @@ jobs: remote_path: / remote_host: ${{ secrets.DOCS_DEPLOY_HOST }} remote_user: ${{ secrets.DOCS_DEPLOY_USER }} - remote_key: ${{ secrets. }} + remote_key: ${{ secrets.DOCS_DEPLOY_KEY }} |