diff --git a/.github/workflows/pr-lint.yml b/.github/workflows/pr-lint.yml new file mode 100644 index 0000000..759b37b --- /dev/null +++ b/.github/workflows/pr-lint.yml @@ -0,0 +1,17 @@ +name: PR Lint + +# Conventional Commits on the PR title and every commit on the branch. +# release-please parses those commit types to decide the version bump and to +# build the changelog - a non-conventional commit silently produces neither. +on: + pull_request: + types: [opened, edited, synchronize, reopened] + +permissions: + contents: read + pull-requests: read + +jobs: + lint: + uses: OneLiteFeatherNET/workflows/.github/workflows/pr-lint.yml@v2.8.1 + secrets: inherit diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml deleted file mode 100644 index aecd892..0000000 --- a/.github/workflows/publish.yaml +++ /dev/null @@ -1,9 +0,0 @@ -name: Publish JAR -on: - push: - tags: ["v*"] - -jobs: - publish: - uses: OneLiteFeatherNET/workflows/.github/workflows/gradle-publish.yml@v2.8.1 - secrets: inherit diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml index 4facf95..ded899d 100644 --- a/.github/workflows/release-please.yaml +++ b/.github/workflows/release-please.yaml @@ -10,3 +10,42 @@ permissions: jobs: release: uses: OneLiteFeatherNET/workflows/.github/workflows/release-please.yml@v2.8.1 + + + publish: + name: Publish to OneLiteFeatherRepo + needs: release + if: needs.release.outputs.release_created == 'true' + uses: OneLiteFeatherNET/workflows/.github/workflows/gradle-publish.yml@v2.8.1 + with: + java-version: "25" + java-distribution: "temurin" + publish-task: "publish" + secrets: inherit + sbom: + name: Attach SBOM to release + needs: release + if: needs.release.outputs.release_created == 'true' + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + ref: ${{ needs.release.outputs.tag_name }} + + - name: Generate CycloneDX SBOM + uses: aquasecurity/trivy-action@v0.36.0 + with: + scan-type: fs + scan-ref: . + format: cyclonedx + output: bom.json + exit-code: '0' + + - name: Attach SBOM to the release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: ${{ needs.release.outputs.tag_name }} + run: gh release upload "$TAG" bom.json --clobber diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml new file mode 100644 index 0000000..90cecb7 --- /dev/null +++ b/.github/workflows/security.yml @@ -0,0 +1,55 @@ +name: Security + +# Trivy vulnerability gate plus a CycloneDX SBOM of the repository. Self-contained +# on purpose: it needs no build tool and no registry credentials, so it is the +# baseline security gate for every repository regardless of language. +on: + pull_request: + push: + branches: [main] + schedule: + - cron: "28 6 * * 1" + workflow_dispatch: +permissions: + contents: read + security-events: write + +jobs: + trivy: + name: Trivy scan + uses: OneLiteFeatherNET/workflows/.github/workflows/security-scan.yml@v2.8.1 + with: + scan-type: "fs" + scanners: "vuln,secret" + severity: "CRITICAL,HIGH" + # Report-only for now, so adopting this does not turn CI red on day one. + fail-on-findings: false + upload-sarif: true + secrets: inherit + + sbom: + name: CycloneDX SBOM + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Generate SBOM + uses: aquasecurity/trivy-action@v0.36.0 + with: + scan-type: fs + scan-ref: . + format: cyclonedx + output: bom.json + # An SBOM is an inventory, not a finding list - never fail on it. + exit-code: '0' + + - name: Upload SBOM + uses: actions/upload-artifact@v4 + with: + name: sbom-cyclonedx + path: bom.json + if-no-files-found: error + retention-days: 90 diff --git a/commitlint.config.mjs b/commitlint.config.mjs new file mode 100644 index 0000000..0616fb9 --- /dev/null +++ b/commitlint.config.mjs @@ -0,0 +1,3 @@ +export default { + extends: ['@commitlint/config-conventional'], +}; diff --git a/release-please-config.json b/release-please-config.json index b821e1c..e224fd0 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -3,7 +3,7 @@ "release-type": "simple", "include-component-in-tag": false, "include-v-in-tag": true, - "bootstrap-sha": "HEAD", + "bootstrap-sha": "8e4c4afcb2c59f5696a9b0fef827b8ae77726522", "pull-request-header": "", "packages": { ".": { diff --git a/renovate.json b/renovate.json index 50dc891..894adb3 100644 --- a/renovate.json +++ b/renovate.json @@ -2,7 +2,7 @@ "$schema": "https://docs.renovatebot.com/renovate-schema.json", "extends": [ "github>OneLiteFeatherNET/renovate:default(OneLiteFeatherNET/butterfly-maintainers)", - "github>OneLiteFeatherNET/renovate:paper", - "github>OneLiteFeatherNET/renovate:minestom" + "github>OneLiteFeatherNET/renovate:minestom", + "github>OneLiteFeatherNET/renovate:paper" ] }