Merge pull request #25 from vpa1977/rename_maven #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
validateSample: | |
name: Validate samples | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Build and verify Gradle sample projects | |
run: | | |
./gradlew publishToMavenLocal | |
cd examples/gradle | |
for x in $(find . -maxdepth 1 -type d -not -name '.' -print); do | |
(cd $x && ./gradlew -i create-rock) | |
done | |
build-maven: | |
name: Build Maven | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
run: | | |
sudo apt-get install -y openjdk-8-jdk-headless | |
- name: Setup LXD | |
uses: canonical/setup-lxd@main | |
with: | |
channel: 5.21/candidate | |
- name: Setup rockcraft | |
run: | | |
rm -rf /home/runner/.local/state/rockcraft/log/* | |
sudo snap remove rockcraft || true | |
sudo snap install rockcraft --classic | |
- name: Build and verify maven project | |
run: | | |
mvn -B install invoker:install invoker:run | |
build-gradle: | |
name: Build Gradle | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
run: | | |
sudo apt-get install -y openjdk-8-jdk-headless | |
- 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 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 |