Skip to content

Commit 6541080

Browse files
committed
feat: add GitHub Actions workflows for build, release checks, and publishing to Plugin Portal
1 parent c61b35e commit 6541080

6 files changed

Lines changed: 112 additions & 1 deletion

File tree

‎.github/workflows/build.yml‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
on:
2+
workflow_call:
3+
workflow_dispatch:
4+
push:
5+
pull_request:
6+
types:
7+
- opened
8+
- reopened
9+
- synchronize
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Set up Java
17+
uses: actions/setup-java@v5
18+
with:
19+
java-version: "21"
20+
distribution: "temurin"
21+
- name: Build
22+
run: ./gradlew clean build
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Check rules for release
2+
on:
3+
workflow_call:
4+
5+
jobs:
6+
check-release:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Check branch and tag
10+
if: github.event_name == 'push' && !(github.ref == 'refs/heads/main' && startsWith(github.ref, 'refs/tags/'))
11+
run: exit 1
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Publish to GitHub Pages
2+
on:
3+
workflow_dispatch:
4+
release:
5+
types: [created]
6+
push:
7+
branches:
8+
- main
9+
10+
concurrency:
11+
group: github-pages
12+
cancel-in-progress: false
13+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
14+
permissions:
15+
contents: read
16+
pages: write
17+
id-token: write
18+
jobs:
19+
publish_gh_pages:
20+
runs-on: ubuntu-latest
21+
environment:
22+
name: github-pages
23+
url: ${{ steps.deployment.outputs.page_url }}
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
- name: Configure Pages
28+
uses: actions/configure-pages@v5
29+
- name: Install Node.js
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: "22"
33+
- name: Install Antora
34+
run: npm i antora
35+
- name: Install Asciidoctor Kroki extension
36+
run: npm i asciidoctor asciidoctor-kroki
37+
- name: Generate Site
38+
run: npx antora docs/antora-playbook.yml
39+
- name: Create site folders
40+
run: mkdir -p docs/build/site
41+
- name: Upload Artifacts
42+
uses: actions/upload-pages-artifact@v3
43+
with:
44+
path: docs/build/site
45+
- name: Deploy to GitHub Pages
46+
id: deployment
47+
uses: actions/deploy-pages@v4
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
name: Publish Gradle Plugin to Plugin Portal
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
check-release:
9+
name: Reuse check release
10+
uses: ./.github/workflows/check_release.yml
11+
build:
12+
name: Reuse build
13+
uses: ./.github/workflows/build.yml
14+
publish:
15+
needs:
16+
- build
17+
- check-release
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Set up Java for publishing to Gradle Plugin Portal
22+
uses: actions/setup-java@v5
23+
with:
24+
java-version: "21"
25+
distribution: "temurin"
26+
- name: Publish plugin to Gradle Plugin Portal
27+
run: ./gradlew publishPlugins
28+
env:
29+
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }}
30+
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }}

‎build.gradle‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ plugins {
22
id 'java-gradle-plugin'
33
id 'java-library'
44
id 'maven-publish'
5+
id 'io.spring.javaformat' version '0.0.47'
56
}
67

78
group = 'se.lfv.reqstool'

‎gradle/wrapper/gradle-wrapper.properties‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)