forked from rockcrafters/java-rockcraft-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (51 loc) · 1.36 KB
/
build.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
name: Build
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
gradlevalidation:
name: "Validate Gradle Wrapper"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gradle/actions/wrapper-validation@v4
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
- name: Setup LXD
uses: canonical/setup-lxd@main
with:
channel: 5.21/candidate
- name: Setup rockcraft
run: |
sudo snap install rockcraft --classic
- name: Build and verify maven project
run: |
mvn install invoker:install invoker:run
- name: Build and verify gradle project
run: |
./gradlew clean build -i
- name: Publish Snapshots
if: github.ref == 'refs/heads/master'
run: |
# Find project version
ver=$(./gradlew properties -q | grep "version:" | awk '{print $2}')
# deploy if snapshot found
if [[ $ver == *"SNAPSHOT"* ]]
then
sudo snap install rockcraft --classic
lxd init --auto
./gradlew publish
fi
shell: bash