Fixed spaces
[Mograsim.git] / .github / workflows / maven.yml
1 name: Java CI
2
3 on: [push]
4
5 jobs:
6   build-and-deploy:
7
8     runs-on: ubuntu-latest
9
10     steps:
11     - uses: actions/checkout@v2
12     - name: Checkout submodules # See https://github.com/actions/checkout#Checkout-submodules
13       shell: bash
14       run: |
15          auth_header="$(git config --local --get http.https://github.com/.extraheader)"
16          git submodule sync --recursive
17          git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
18     - name: Set up JDK 11
19       uses: actions/setup-java@v1
20       with:
21         java-version: 11
22     - name: Cache Maven Dependencies
23       uses: actions/cache@v2.1.1
24       with:
25         path: ~/.m2/repository
26         key: mograsim-maven-${{ hashFiles('**/pom.xml', '**/MANIFEST.MF', '.github/workflows/maven.yml') }}
27         restore-keys: |
28           mograsim-maven-
29     - name: Build with Maven
30       run: mvn --batch-mode --errors --fail-at-end --show-version clean verify --file pom.xml
31     - name: Deploy to mograsim.net
32       env:
33         DEPLOY_KEY: ${{secrets.DEPLOY_KEY}}
34         MOGRASIM_NET_HOST_PUBKEY: ${{secrets.MOGRASIM_NET_HOST_PUBKEY }}
35         REF: ${{github.ref}}
36       run: |
37         mkdir -p ~/.ssh || { echo Creating '~/.ssh' failed, aborting; exit 1; }
38         touch ~/.ssh/id_rsa_deploy
39         chmod 600 ~/.ssh/id_rsa_deploy
40         printenv DEPLOY_KEY > ~/.ssh/id_rsa_deploy
41         printenv MOGRASIM_NET_HOST_PUBKEY >> ~/.ssh/known_hosts
42         date=$(date +%Y%m%d_%H%M%S)
43         scp -i ~/.ssh/id_rsa_deploy -r releng/net.mograsim.plugin.updatesite/target/repository mgsdeploy@mograsim.net:/mograsim/upload_tmp/$date
44           || { echo Uploading files failed, aborting; exit 1; }
45         exec ssh -i ~/.ssh/id_rsa_deploy mgsdeploy@mograsim.net /mograsim/upload_updatesite_finished.sh $date $REF