|
| 1 | +# Copyright 2021 Google Inc. |
| 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 | +# http://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: Nightly Builds |
| 16 | + |
| 17 | +on: |
| 18 | + # Runs every day at 06:10 AM (PT) and 08:10 PM (PT) / 04:10 AM (UTC) and 02:10 PM (UTC) |
| 19 | + # or on 'firebase_nightly_build' repository dispatch event. |
| 20 | + schedule: |
| 21 | + - cron: "10 4,14 * * *" |
| 22 | + repository_dispatch: |
| 23 | + types: [firebase_nightly_build] |
| 24 | + |
| 25 | +jobs: |
| 26 | + nightly: |
| 27 | + |
| 28 | + runs-on: ubuntu-latest |
| 29 | + |
| 30 | + steps: |
| 31 | + - name: Checkout source for staging |
| 32 | + uses: actions/checkout@v2 |
| 33 | + with: |
| 34 | + ref: ${{ github.event.client_payload.ref || github.ref }} |
| 35 | + |
| 36 | + - name: Set up JDK 1.7 |
| 37 | + uses: actions/setup-java@v1 |
| 38 | + with: |
| 39 | + java-version: 1.7 |
| 40 | + |
| 41 | + - name: Compile, test and package |
| 42 | + run: ./.github/scripts/package_artifacts.sh |
| 43 | + env: |
| 44 | + FIREBASE_SERVICE_ACCT_KEY: ${{ secrets.FIREBASE_SERVICE_ACCT_KEY }} |
| 45 | + FIREBASE_API_KEY: ${{ secrets.FIREBASE_API_KEY }} |
| 46 | + |
| 47 | + # Attach the packaged artifacts to the workflow output. These can be manually |
| 48 | + # downloaded for later inspection if necessary. |
| 49 | + - name: Archive artifacts |
| 50 | + uses: actions/upload-artifact@v1 |
| 51 | + with: |
| 52 | + name: dist |
| 53 | + path: dist |
| 54 | + |
| 55 | + - name: Send email on failure |
| 56 | + if: failure() |
| 57 | + uses: firebase/firebase-admin-node/.github/actions/send-email |
| 58 | + with: |
| 59 | + api-key: ${{ secrets.OSS_BOT_MAILGUN_KEY }} |
| 60 | + domain: ${{ secrets.OSS_BOT_MAILGUN_DOMAIN }} |
| 61 | + from: 'GitHub <admin-github@${{ secrets.OSS_BOT_MAILGUN_DOMAIN }}>' |
| 62 | + to: ${{ secrets.FIREBASE_ADMIN_GITHUB_EMAIL }} |
| 63 | + subject: 'Nightly build ${{github.run_id}} of ${{github.repository}} failed!' |
| 64 | + html: > |
| 65 | + <b>Nightly workflow ${{github.run_id}} failed on: ${{github.repository}}</b> |
| 66 | + <br /><br />Navigate to the |
| 67 | + <a href="https://github.com/firebase/firebase-admin-java/actions/runs/${{github.run_id}}">failed workflow</a>. |
| 68 | + continue-on-error: true |
| 69 | + |
| 70 | + - name: Send email on cancelled |
| 71 | + if: cancelled() |
| 72 | + uses: firebase/firebase-admin-node/.github/actions/send-email |
| 73 | + with: |
| 74 | + api-key: ${{ secrets.OSS_BOT_MAILGUN_KEY }} |
| 75 | + domain: ${{ secrets.OSS_BOT_MAILGUN_DOMAIN }} |
| 76 | + from: 'GitHub <admin-github@${{ secrets.OSS_BOT_MAILGUN_DOMAIN }}>' |
| 77 | + to: ${{ secrets.FIREBASE_ADMIN_GITHUB_EMAIL }} |
| 78 | + subject: 'Nightly build ${{github.run_id}} of ${{github.repository}} cancelled!' |
| 79 | + html: > |
| 80 | + <b>Nightly workflow ${{github.run_id}} cancelled on: ${{github.repository}}</b> |
| 81 | + <br /><br />Navigate to the |
| 82 | + <a href="https://github.com/firebase/firebase-admin-java/actions/runs/${{github.run_id}}">cancelled workflow</a>. |
| 83 | + continue-on-error: true |
0 commit comments