Skip to content

Commit 1a2d9b1

Browse files
committed
ci: Add GH workflows
1 parent 5fd6905 commit 1a2d9b1

File tree

6 files changed

+125
-25
lines changed

6 files changed

+125
-25
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: publish documentation
1+
name: Publish Documentation
22
on:
33
push:
44
branches:

.github/workflows/main.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# GitHub Actions Workflow is created for testing and preparing the plugin release in the following steps:
2+
# - Remove Old Draft Releases
3+
# - Create New Draft Release
4+
# The workflow is triggered on push to the main branch
5+
#
6+
# GitHub Actions reference: https://help.github.com/en/actions
7+
#
8+
on:
9+
push:
10+
branches:
11+
- main
12+
13+
jobs:
14+
publish_snapshot:
15+
name: Publish Snapshot
16+
runs-on: ubuntu-latest
17+
steps:
18+
# Check out current repository
19+
- name: Fetch Sources
20+
uses: actions/checkout@v3
21+
22+
# Set up Java environment for the next steps
23+
- name: Setup Java
24+
uses: actions/setup-java@v3
25+
with:
26+
distribution: zulu
27+
java-version: 17
28+
- name: Publish Snapshot
29+
run: |
30+
chmod +x ./publish_snapshot.sh
31+
./publish_snapshot.sh ${{secrets.ORG_GRADLE_PROJECT_MAVENCENTRALUSERNAME}} ${{secrets.ORG_GRADLE_PROJECT_MAVENCENTRALPASSWORD}}
32+
33+
update_draft_release:
34+
name: Create or Update Draft Release
35+
runs-on: ubuntu-latest
36+
steps:
37+
# Check out current repository
38+
- name: Fetch Sources
39+
uses: actions/checkout@v3
40+
41+
# Set up Java environment for the next steps
42+
- name: Setup Java
43+
uses: actions/setup-java@v3
44+
with:
45+
distribution: zulu
46+
java-version: 17
47+
48+
# Set environment variables
49+
- name: Export Properties
50+
id: properties
51+
shell: bash
52+
run: |
53+
PROPERTIES="$(./gradlew properties --console=plain -q)"
54+
VERSION="$(echo "$PROPERTIES" | grep "^VERSION_NAME:" | cut -f2- -d ' ')"
55+
chmod +x ./get_changelog.sh
56+
CHANGELOG="$(./get_changelog.sh $VERSION)"
57+
echo "version=$VERSION" >> $GITHUB_OUTPUT
58+
echo "changelog=$(echo "$CHANGELOG" | base64 )" >> $GITHUB_OUTPUT
59+
60+
# Remove old release drafts by using the curl request for the available releases with a draft flag
61+
- name: Remove Old Release Drafts
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
run: |
65+
gh api repos/{owner}/{repo}/releases \
66+
--jq '.[] | select(.draft == true) | .id' \
67+
| xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}
68+
69+
# Create a new release draft which is not publicly visible and requires manual acceptance
70+
- name: Create Release Draft
71+
env:
72+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
run: |
74+
gh release create v${{ steps.properties.outputs.version }} \
75+
--draft \
76+
--title "v${{ steps.properties.outputs.version }}" \
77+
--notes "$(echo "${{ steps.properties.outputs.changelog }}" | base64 --decode)"

.github/workflows/publish.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Publish Artifacts to Maven Central
2+
on:
3+
release:
4+
types: [ created ]
5+
jobs:
6+
publish:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v2
11+
- name: Setup Java
12+
uses: actions/setup-java@v1
13+
with:
14+
java-version: 17
15+
16+
- name: publish to maven central
17+
run: ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache
18+
19+

.github/workflows/verify.yml

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
1-
on:
2-
pull_request:
3-
branches:
4-
- main
5-
types:
6-
- opened
7-
- synchronize
8-
- reopened
9-
jobs:
10-
verify:
11-
runs-on: ubuntu-latest
12-
steps:
13-
- name: Checkout
14-
uses: actions/checkout@v2
15-
- name: Setup Java
16-
uses: actions/setup-java@v1
17-
with:
18-
java-version: 17
1+
name: Verify Pull Request
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
types:
7+
- opened
8+
- synchronize
9+
- reopened
10+
jobs:
11+
verify:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v2
16+
- name: Setup Java
17+
uses: actions/setup-java@v1
18+
with:
19+
java-version: 17
1920

20-
- name: Spotless check
21-
run: ./gradlew spotlessCheck
21+
- name: Spotless check
22+
run: ./gradlew spotlessCheck
2223

23-
- name: Detekt check
24-
run: ./gradlew detekt
24+
- name: Detekt check
25+
run: ./gradlew detekt
2526

26-
- name: Run Tests
27-
run: ./gradlew test
27+
- name: Run Tests
28+
run: ./gradlew test

.idea/.gitignore

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)