Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Github Actions to build and release #143

Merged
merged 10 commits into from
May 4, 2023
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.

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

on:
push:
branches:
- master
pull_request:
- master

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

- name: Setup Java
uses: oracle-actions/setup-java@v1
with:
website: jdk.java.net
release: 17

- name: Build and verify project
run: ./gradlew clean build test

- 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 }}
46 changes: 43 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,51 @@ on:

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

- name: Setup Java
uses: oracle-actions/setup-java@v1
with:
website: jdk.java.net
release: 17

- name: Build and verify project
run: ./gradlew clean build test

- 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
40 changes: 0 additions & 40 deletions .travis.yml

This file was deleted.