|
| 1 | +# Copyright © 2022 Cask Data, Inc. |
| 2 | +# Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| 3 | +# use this file except in compliance with the License. You may obtain a copy of |
| 4 | +# the License at |
| 5 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | +# Unless required by applicable law or agreed to in writing, software |
| 7 | +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 8 | +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 9 | +# License for the specific language governing permissions and limitations under |
| 10 | +# the License. |
| 11 | + |
| 12 | +name: Build and Deploy |
| 13 | +on: |
| 14 | + schedule: |
| 15 | + - cron: '0 8 * * *' |
| 16 | + workflow_dispatch: |
| 17 | + |
| 18 | +jobs: |
| 19 | + build: |
| 20 | + runs-on: k8s-runner-build |
| 21 | + |
| 22 | + strategy: |
| 23 | + fail-fast: false |
| 24 | + matrix: |
| 25 | + branch: [ develop, release/1.7 ] |
| 26 | + |
| 27 | + steps: |
| 28 | + - name: Get Secrets from GCP Secret Manager |
| 29 | + id: 'secrets' |
| 30 | + uses: 'google-github-actions/get-secretmanager-secrets@v0' |
| 31 | + with: |
| 32 | + secrets: |- |
| 33 | + CDAP_OSSRH_USERNAME:cdapio-github-builds/CDAP_OSSRH_USERNAME |
| 34 | + CDAP_OSSRH_PASSWORD:cdapio-github-builds/CDAP_OSSRH_PASSWORD |
| 35 | + CDAP_GPG_PASSPHRASE:cdapio-github-builds/CDAP_GPG_PASSPHRASE |
| 36 | + CDAP_GPG_PRIVATE_KEY:cdapio-github-builds/CDAP_GPG_PRIVATE_KEY |
| 37 | +
|
| 38 | + - name: Recursively Checkout Repository |
| 39 | + uses: actions/checkout@v3 |
| 40 | + with: |
| 41 | + fetch-depth: 0 |
| 42 | + path: netty |
| 43 | + ref: ${{ matrix.branch }} |
| 44 | + |
| 45 | + - name: Cache |
| 46 | + uses: actions/cache@v2.1.3 |
| 47 | + with: |
| 48 | + path: ~/.m2/repository |
| 49 | + key: ${{ runner.os }}-maven-${{ github.workflow }}-${{ hashFiles('**/pom.xml') }} |
| 50 | + restore-keys: | |
| 51 | + ${{ runner.os }}-maven-${{ github.workflow }} |
| 52 | +
|
| 53 | + - name: Set up GPG conf |
| 54 | + run: | |
| 55 | + echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf |
| 56 | + echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf |
| 57 | +
|
| 58 | + - name: Import GPG key |
| 59 | + run: | |
| 60 | + echo "$GPG_PRIVATE_KEY" > private.key |
| 61 | + gpg --import --batch private.key |
| 62 | + env: |
| 63 | + GPG_PRIVATE_KEY: ${{ steps.secrets.outputs.CDAP_GPG_PRIVATE_KEY }} |
| 64 | + |
| 65 | + - name: Deploy Maven |
| 66 | + working-directory: netty |
| 67 | + run: mvn -U clean deploy -P release -Dgpg.passphrase=$CDAP_GPG_PASSPHRASE |
| 68 | + env: |
| 69 | + CDAP_OSSRH_USERNAME: ${{ steps.secrets.outputs.CDAP_OSSRH_USERNAME }} |
| 70 | + CDAP_OSSRH_PASSWORD: ${{ steps.secrets.outputs.CDAP_OSSRH_PASSWORD }} |
| 71 | + CDAP_GPG_PASSPHRASE: ${{ steps.secrets.outputs.CDAP_GPG_PASSPHRASE }} |
0 commit comments