|
| 1 | +name: Deploy |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onpull_requestpull_request_targetbranchesbranches-ignore |
| 6 | + branches: |
| 7 | + - prod |
| 8 | + |
| 9 | +# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions |
| 10 | +permissions: |
| 11 | + contents: read # for "git clone" |
| 12 | + |
| 13 | +defaults: |
| 14 | + # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrun |
| 15 | + run: |
| 16 | + # Enable fail-fast behavior using set -eo pipefail |
| 17 | + # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference |
| 18 | + shell: bash |
| 19 | + |
| 20 | +jobs: |
| 21 | + deploy: |
| 22 | + name: Deploy |
| 23 | + # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on |
| 24 | + runs-on: ubuntu-20.04 |
| 25 | + steps: |
| 26 | + |
| 27 | + - name: Clone source code |
| 28 | + uses: actions/[email protected] # https://github.com/actions/checkout |
| 29 | + with: |
| 30 | + # Whether to configure the token or SSH key with the local git config. Default: true |
| 31 | + persist-credentials: false |
| 32 | + |
| 33 | + - name: Install JDK |
| 34 | + uses: actions/[email protected] # https://github.com/actions/setup-java |
| 35 | + with: |
| 36 | + distribution: 'adopt' # https://github.com/actions/setup-java#supported-distributions |
| 37 | + java-version: '8' # https://github.com/actions/setup-java#supported-version-syntax |
| 38 | + cache: 'maven' # https://github.com/actions/setup-java#caching-packages-dependencies |
| 39 | + |
| 40 | + - name: Build WAR file |
| 41 | + # NOTE: we use -Dmaven.test.skip=true instead of -DskipUnitTests=true |
| 42 | + # in order to skip both compilation and execution of the tests |
| 43 | + run: >- |
| 44 | + mvn \ |
| 45 | + --batch-mode \ |
| 46 | + -Denforcer.skip=true \ |
| 47 | + -Dmaven.test.skip=true \ |
| 48 | + package |
| 49 | +
|
| 50 | + - name: Install ansible |
| 51 | + run: pip3 install --user ansible==2.9.27 |
| 52 | + |
| 53 | + - name: Run deploy.sh |
| 54 | + env: |
| 55 | + # https://docs.github.com/en/actions/security-guides/encrypted-secrets#using-encrypted-secrets-in-a-workflow |
| 56 | + VAULT_PASSWORD: ${{ secrets.VAULT_PASSWORD }} |
| 57 | + run: ./src/main/scripts/ci/deploy.sh |
0 commit comments