Skip to content

Commit

Permalink
Make updates to Gradle and add Github Actions
Browse files Browse the repository at this point in the history
* to facilitate versioned releases
  • Loading branch information
pacphi committed Oct 17, 2024
1 parent 07f1712 commit bc30f0d
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 4 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,13 @@ jobs:
with:
distribution: liberica
java-version: ${{ matrix.java }}
- uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build with Gradle
run: ./gradlew build
run: ./gradlew clean build -Dvaadin.productionMode=true
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish package to GitHub Packages
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
checks: write
actions: read
issues: read
packages: write
pull-requests: read
repository-projects: read
statuses: read
steps:
- uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: liberica
java-version: 21
- name: Install GitHub CLI
run: |
sudo apt update && sudo apt install gh -y
- name: Publish package
run: |
./gradlew clean setVersion -PnewVersion=${{ github.event.release.tag_name }} build -Dvaadin.productionMode=true
SUFFIX="${{ github.event.release.tag_name }}"
echo "Uploading sanford-ui-$SUFFIX.jar to release ${{ github.event.release.tag_name }}"
gh release upload "${{ github.event.release.tag_name }}" build/libs/sanford-ui-${{ github.event.release.tag_name }}.jar --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14 changes: 11 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ plugins {
}

group = 'org.cftoolsuite'
version = '0.0.1-SNAPSHOT'

java {
toolchain {
Expand All @@ -23,7 +22,7 @@ repositories {

ext {
set('springCloudVersion', "2023.0.3")
set('vaadinVersion', "24.4.13")
set('vaadinVersion', "24.5.0")
}

dependencies {
Expand Down Expand Up @@ -55,4 +54,13 @@ tasks.named('test') {

bootRun {
systemProperties System.properties
}
}

task setVersion {
doLast {
def newVersion = project.hasProperty('newVersion') ? project.newVersion : version
ant.propertyfile(file: "gradle.properties") {
entry(key: "version", value: newVersion)
}
}
}
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version=0.0.1-SNAPSHOT

0 comments on commit bc30f0d

Please sign in to comment.