Skip to content

Commit 3c8054c

Browse files
committed
feat: Add GitHub Actions workflows for building PRs, closing invalid PRs, and releasing
1 parent 774f9f6 commit 3c8054c

File tree

3 files changed

+102
-0
lines changed

3 files changed

+102
-0
lines changed

.github/workflows/build-pr.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Build PR
2+
on: [pull_request]
3+
jobs:
4+
build_pr:
5+
if: github.repository_owner == 'OneLiteFeatherNET'
6+
name: Build Pull Request Branch
7+
runs-on: ${{ matrix.os }}
8+
env:
9+
ONELITEFEATHER_MAVEN_USERNAME: ${{ secrets.ONELITEFEATHER_MAVEN_USERNAME }}
10+
ONELITEFEATHER_MAVEN_PASSWORD: ${{ secrets.ONELITEFEATHER_MAVEN_PASSWORD }}
11+
strategy:
12+
matrix:
13+
os: [ubuntu-latest, windows-latest, macos-latest]
14+
steps:
15+
- name: Checkout Repository
16+
uses: actions/checkout@v4
17+
- name: Setup Java
18+
uses: actions/setup-java@v4
19+
with:
20+
distribution: temurin
21+
java-version: 24
22+
- name: Setup Gradle
23+
uses: gradle/actions/setup-gradle@v4
24+
- name: Build on ${{ matrix.os }}
25+
run: ./gradlew clean build test
26+
# - name: Generate JaCoCo Coverage Report
27+
# if: matrix.os == 'ubuntu-latest'
28+
# run: ./gradlew jacocoTestReport
29+
# - name: Jacoco Report to PR
30+
# id: jacoco
31+
# uses: madrapps/[email protected]
32+
# with:
33+
# paths: ${{ github.workspace }}/build/reports/jacoco/test/jacocoTestReport.xml
34+
# token: ${{ secrets.GITHUB_TOKEN }}
35+
# min-coverage-overall: 40
36+
# min-coverage-changed-files: 60
37+
# title: Code Coverage
38+
# update-comment: true
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Close invalid PRs
2+
3+
on:
4+
pull_request_target:
5+
types: [ opened ]
6+
7+
jobs:
8+
run:
9+
if: ${{ github.repository != github.event.pull_request.head.repo.full_name && github.head_ref == 'main' }}
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: superbrothers/close-pull-request@v3
13+
with:
14+
comment: "Please do not open pull requests from the `main` branch, create a new branch instead."
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Release
2+
"on":
3+
push:
4+
branches:
5+
- main
6+
- next
7+
- beta
8+
- "*.x"
9+
10+
permissions:
11+
contents: read # for checkout
12+
13+
jobs:
14+
release:
15+
name: Release
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: write # to be able to publish a GitHub release
19+
issues: write # to be able to comment on released issues
20+
pull-requests: write # to be able to comment on released pull requests
21+
id-token: write # to enable use of OIDC for npm provenance
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
- name: Setup Node.js
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: "lts/*"
31+
- name: Validate Gradle Wrapper
32+
uses: gradle/actions/wrapper-validation@v4
33+
- name: Setup Java
34+
uses: actions/setup-java@v4
35+
with:
36+
distribution: temurin
37+
java-version: 24
38+
- name: Setup Gradle
39+
uses: gradle/actions/setup-gradle@v4
40+
- name: Install dependencies
41+
run: npm clean-install
42+
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
43+
run: npm audit signatures
44+
- name: Release
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
48+
ONELITEFEATHER_MAVEN_USERNAME: ${{ secrets.ONELITEFEATHER_MAVEN_USERNAME }}
49+
ONELITEFEATHER_MAVEN_PASSWORD: ${{ secrets.ONELITEFEATHER_MAVEN_PASSWORD }}
50+
run: npx semantic-release

0 commit comments

Comments
 (0)