Skip to content

Commit

Permalink
Use Github Actions to build and release (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinayagarwal authored May 4, 2023
1 parent a2bec31 commit 9ab0bd0
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 94 deletions.
10 changes: 0 additions & 10 deletions .ci/deploy-snapshot.sh

This file was deleted.

22 changes: 0 additions & 22 deletions .ci/release.sh

This file was deleted.

48 changes: 48 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build

on:
push:
branches:
- master
pull_request:

jobs:
gradlevalidation:
name: "Validate Gradle Wrapper"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'

- name: Build and verify project
run: |
export DISPLAY=:90
Xvfb -ac :90 -screen 0 1280x1024x24 > /dev/null 2>&1 &
./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
./gradlew publish -PsonatypeUsername=$SONATYPE_USERNAME -PsonatypePassword=$SONATYPE_PASSWORD
fi
shell: bash
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
49 changes: 46 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,54 @@ on:

jobs:
build:
name: release-notes
name: release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'

- name: Build and verify project
run: |
export DISPLAY=:90
Xvfb -ac :90 -screen 0 1280x1024x24 > /dev/null 2>&1 &
./gradlew clean build -i
- name: Publish to Gradle plugin repository
id: deploy
if: github.ref == 'refs/heads/master'
run: |
./gradlew publishPlugins -Pgradle.publish.key=$PUBLISH_KEY -Pgradle.publish.secret=$PUBLISH_SECRET
shell: bash
env:
PUBLISH_KEY: ${{ secrets.PUBLISH_KEY }}
PUBLISH_SECRET: ${{ secrets.PUBLISH_SECRET }}

- name: Commit next development version
if: steps.deploy.outputs.exit_code == 0
run: |
TAG=${GITHUB_REF/refs\/tags\//}
# Update README with the latest released version
sed -i "0,/id 'org.openjfx.javafxplugin' version '.*'/s//id 'org.openjfx.javafxplugin' version '$TAG'/" README.md
sed -i "0,/id(\"org.openjfx.javafxplugin\") version \".*\"/s//id(\"org.openjfx.javafxplugin\") version \"$TAG\"/" README.md
sed -i "0,/'org.openjfx:javafx-plugin:.*'/s//'org.openjfx:javafx-plugin:$TAG'/" README.md
sed -i "0,/\"org.openjfx:javafx-plugin:.*\"/s//\"org.openjfx:javafx-plugin:$TAG\"/" README.md
git commit README.md -m "Use latest release v$TAG in README"
# Update project version
newVersion=${TAG%.*}.$((${TAG##*.} + 1))
echo "Update project version to next snapshot version"
sed -i "0,/^version '$TAG'/s//version '$newVersion-SNAPSHOT'/" build.gradle
git commit build.gradle -m "Prepare development of $newVersion" --author "Github Bot <githubbot@gluonhq.com>"
git push https://gluon-bot:$PAT@github.com/openjfx/javafx-gradle-plugin HEAD:master
env:
PAT: ${{ secrets.GITHUB_TOKEN }}

- name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.PAT }}
generate_release_notes: true
generate_release_notes: true
16 changes: 0 additions & 16 deletions .github/workflows/tests.yml

This file was deleted.

40 changes: 0 additions & 40 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions src/test/java/org/openjfx/gradle/JavaFXPluginSmokeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void smokeTestModular() {
var result = GradleRunner.create()
.withProjectDir(new File("test-project"))
.withGradleVersion("6.0.1")
.withArguments("clean", "build", "run", "--stacktrace")
.withArguments("clean", "build", "run", "--stacktrace", "--refresh-dependencies")
.forwardOutput()
.build();

Expand All @@ -56,7 +56,7 @@ void smokeTestNonModular() {
var result = GradleRunner.create()
.withProjectDir(new File("test-project"))
.withGradleVersion("6.0.1")
.withArguments("clean", "build", "run", "--stacktrace")
.withArguments("clean", "build", "run", "--stacktrace", "--refresh-dependencies")
.forwardOutput()
.build();

Expand All @@ -68,7 +68,7 @@ void smokeTestTransitive() {
var result = GradleRunner.create()
.withProjectDir(new File("test-project"))
.withGradleVersion("6.0.1")
.withArguments("clean", "build", "run", "--stacktrace")
.withArguments("clean", "build", "run", "--stacktrace", "--refresh-dependencies")
.forwardOutput()
.build();

Expand Down

0 comments on commit 9ab0bd0

Please sign in to comment.