Skip to content

Add CI workflows and update Gradle build script #1

Add CI workflows and update Gradle build script

Add CI workflows and update Gradle build script #1

Workflow file for this run

name: Test and Publish
on:
push:
branches:
- main
tags:
- 'alpha-*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Run tests
run: ./gradlew test
publish:
if: startsWith(github.ref, 'refs/tags/alpha')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Publish Plugin
run: ./gradlew publishPlugin
env:
PLUGIN_REPO: ${{ secrets.PLUGIN_REPO }}
PLUGIN_TOKEN: ${{ secrets.PLUGIN_TOKEN }}