diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 06c61ea..16d1244 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 \ No newline at end of file + run: ./gradlew clean build -Dvaadin.productionMode=true \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..205f3fb --- /dev/null +++ b/.github/workflows/release.yml @@ -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 }} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 2f46a73..dbdc49d 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,6 @@ plugins { } group = 'org.cftoolsuite' -version = '0.0.1-SNAPSHOT' java { toolchain { @@ -23,7 +22,7 @@ repositories { ext { set('springCloudVersion', "2023.0.3") - set('vaadinVersion', "24.4.13") + set('vaadinVersion', "24.5.0") } dependencies { @@ -55,4 +54,13 @@ tasks.named('test') { bootRun { systemProperties System.properties -} \ No newline at end of file +} + +task setVersion { + doLast { + def newVersion = project.hasProperty('newVersion') ? project.newVersion : version + ant.propertyfile(file: "gradle.properties") { + entry(key: "version", value: newVersion) + } + } +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..6b09920 --- /dev/null +++ b/gradle.properties @@ -0,0 +1 @@ +version=0.0.1-SNAPSHOT