-
Notifications
You must be signed in to change notification settings - Fork 77
74 lines (61 loc) · 1.93 KB
/
build-on-merge.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: build-on-merge
on:
push:
branches:
- master
- sdk_4.4
tags:
workflow_dispatch:
env:
LD_LIBRARY_PATH: /usr/local/opt/curl/lib:$LD_LIBRARY_PATH
PYCURL_SSL_LIBRARY: openssl
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
cache: 'maven'
- name: Update packages
run: sudo apt-get update
- name: Install package dependencies
run: sudo apt-get install mmv libssl-dev libcurl4-openssl-dev python-dev python3-pip flake8
- name: Set git defaults
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
- name: Run maven build
run: mvn package -B
- name: Set FOLDER variable according to pushed branch
run: |
if [[ ${GITHUB_REF} == 'refs/heads/master' ]];
then
echo "REMOTE_BRANCH=main" >> $GITHUB_ENV;
else
echo "REMOTE_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV;
fi
- name: Check out target repository
uses: actions/checkout@v2
with:
repository: '${{ secrets.TARGET_REPO }}'
ssh-key: '${{ secrets.DEPLOY_KEY }}'
path: python-ovirt-engine-sdk4
ref: '${{ env.REMOTE_BRANCH }}'
- name: Copy SDK to repository
run: |
rm -rf sdk/target sdk/tests sdk/pom.xml
cp -r sdk/* ./python-ovirt-engine-sdk4/
- name: Push changes to python-ovirt-engine-sdk4
run: |
cd python-ovirt-engine-sdk4
if git status --porcelain 2>/dev/null| grep -E "^??|^M"
then
git add .
git commit -am "Sync with upstream"
git push
fi
cd ..