|
| 1 | +# Copyright 2021 Google LLC |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +name: Cron Schedule |
| 16 | + |
| 17 | +on: |
| 18 | + schedule: |
| 19 | + - cron: '20 6 * * 1' |
| 20 | + |
| 21 | +jobs: |
| 22 | + |
| 23 | + lint-js: |
| 24 | + name: Lint JS |
| 25 | + runs-on: ubuntu-latest |
| 26 | + steps: |
| 27 | + - name: Checkout repository |
| 28 | + uses: actions/checkout@v2 |
| 29 | + with: |
| 30 | + ref: develop |
| 31 | + |
| 32 | + - name: Get npm cache directory |
| 33 | + id: npm-cache |
| 34 | + run: echo "::set-output name=dir::$(npm config get cache)" |
| 35 | + |
| 36 | + - name: Configure npm cache |
| 37 | + uses: actions/cache@v2 |
| 38 | + with: |
| 39 | + path: ${{ steps.npm-cache.outputs.dir }} |
| 40 | + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} |
| 41 | + restore-keys: | |
| 42 | + ${{ runner.os }}-npm- |
| 43 | +
|
| 44 | + - name: Install Node dependencies |
| 45 | + run: npm ci |
| 46 | + |
| 47 | + - name: Detect coding standard violations |
| 48 | + run: npm run lint |
| 49 | + |
| 50 | + deploy-staging: |
| 51 | + needs: [lint-js] |
| 52 | + name: Deploy Staging |
| 53 | + runs-on: ubuntu-latest |
| 54 | + steps: |
| 55 | + - name: Checkout repository |
| 56 | + uses: actions/checkout@v2 |
| 57 | + with: |
| 58 | + ref: develop |
| 59 | + |
| 60 | + - name: Get npm cache directory |
| 61 | + id: npm-cache |
| 62 | + run: echo "::set-output name=dir::$(npm config get cache)" |
| 63 | + |
| 64 | + - name: Configure npm cache |
| 65 | + uses: actions/cache@v2 |
| 66 | + with: |
| 67 | + path: ${{ steps.npm-cache.outputs.dir }} |
| 68 | + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} |
| 69 | + restore-keys: | |
| 70 | + ${{ runner.os }}-npm- |
| 71 | +
|
| 72 | + - name: Install Node dependencies |
| 73 | + run: npm ci |
| 74 | + |
| 75 | + - name: Build Assets |
| 76 | + run: npm run build |
| 77 | + |
| 78 | + - name: Deploy to Firebase |
| 79 | + uses: FirebaseExtended/action-hosting-deploy@v0 |
| 80 | + with: |
| 81 | + repoToken: "${{ secrets.GITHUB_TOKEN }}" |
| 82 | + firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT }}" |
| 83 | + expires: 30d |
| 84 | + projectId: "${{ secrets.FIREBASE_PROJECT_ID }}" |
| 85 | + channelId: staging |
0 commit comments