-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
318 additions
and
284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,22 @@ | ||
name: Build | ||
|
||
on: [pull_request, push, workflow_dispatch] | ||
on: | ||
pull_request: | ||
push: | ||
workflow_dispatch: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
deduplicate: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
should_skip: ${{ steps.skip.outputs.should_skip }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Skip duplicates and docs | ||
id: skip | ||
uses: fkirc/skip-duplicate-actions@v5 | ||
with: | ||
concurrent_skipping: same_content_newer | ||
paths_ignore: '["**/README.md", "LICENSE", ".gitignore", ".editorconfig", ".idea/**"]' | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
needs: deduplicate | ||
if: "needs.pre_job.outputs.should_skip != 'true'" | ||
timeout-minutes: 15 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Validate gradle wrapper | ||
uses: gradle/wrapper-validation-action@v1 | ||
- name: Setup Gradle | ||
uses: gradle/gradle-build-action@v2 | ||
|
||
- name: Setup JDK | ||
uses: actions/setup-java@v4 | ||
|
@@ -37,7 +25,88 @@ jobs: | |
cache: gradle | ||
distribution: temurin | ||
|
||
- name: Build with gradle | ||
env: | ||
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | ||
- name: Build | ||
run: ./gradlew build | ||
|
||
- name: Publish Test Report | ||
if: success() || failure() # run this step even if previous step failed | ||
uses: dorny/test-reporter@v1 | ||
with: | ||
name: Kotest report | ||
path: ./**/build/test-results/test/*.xml | ||
reporter: java-junit | ||
|
||
- name: Publish Coverage Report | ||
uses: codecov/codecov-action@v3 | ||
if: github.repository == 'coditory/klog' && github.ref == 'refs/heads/main' | ||
continue-on-error: true | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
override_commit: ${{ github.event.workflow_run.head_sha }} | ||
override_branch: ${{ github.event.workflow_run.head_branch }} | ||
override_build: ${{ github.event.workflow_run.id }} | ||
files: 'build/reports/kover/report.xml' | ||
|
||
- name: Import GPG Key | ||
id: gpg | ||
uses: crazy-max/ghaction-import-gpg@v5 | ||
if: | | ||
github.repository == 'coditory/klog' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) | ||
with: | ||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
passphrase: ${{ secrets.GPG_PASSPHRASE }} | ||
git_user_signingkey: true | ||
git_commit_gpgsign: true | ||
git_committer_name: Coditory Bot | ||
git_committer_email: [email protected] | ||
|
||
- name: Publish Snapshot | ||
if: github.repository == 'coditory/klog' && github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') | ||
env: | ||
SIGNING_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | ||
SIGNING_PASSWORD: ${{ secrets.GPG_PASSPHRASE }} | ||
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | ||
run: ./gradlew publishJvmPublicationToSnapshotRepository | ||
|
||
- name: Publish Release | ||
id: publish-release | ||
if: github.repository == 'coditory/klog' && startsWith(github.ref, 'refs/tags/v') && (github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'workflow_dispatch') | ||
env: | ||
SIGNING_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | ||
SIGNING_PASSWORD: ${{ secrets.GPG_PASSPHRASE }} | ||
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | ||
RELEASE_TAG_NAME: ${{ github.event.release.tag_name }} | ||
run: | | ||
declare -r RELEASE_VERSION="$([[ "$RELEASE_TAG_NAME" =~ v.* ]] \ | ||
&& (echo "$TAG_NAME" | cut -c2-) \ | ||
|| echo "$TAG_NAME")" | ||
declare -r VERSION_ARG="$([ -n "$RELEASE_VERSION" ] \ | ||
&& echo "-Pversion=$RELEASE_VERSION" \ | ||
|| echo "")" | ||
./gradlew publishJvmPublicationToReleaseRepository $VERSION_ARG | ||
- name: Generate Release Notes | ||
id: generate-release-notes | ||
if: steps.publish-release.conclusion == 'success' | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
declare -r NOTES="$(gh api \ | ||
--method POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
/repos/${{ github.repository }}/releases/generate-notes \ | ||
-f target_commitish='main' \ | ||
| jq -r '.body')" | ||
declare -r ESCAPED="${NOTES//$'\n'/'%0A'}" | ||
echo "notes=$ESCAPED" >> $GITHUB_OUTPUT | ||
- name: Create github release (main only) | ||
if: steps.generate-release-notes.conclusion == 'success' | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
allowUpdates: true | ||
body: ${{ steps.notes.outputs.notes }} | ||
tag: v${{ steps.versions.outputs.next_version }} | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Dependabot | ||
|
||
on: [ pull_request_target ] | ||
|
||
jobs: | ||
dependabot: | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.user.login == 'dependabot[bot]' | ||
permissions: | ||
pull-requests: write | ||
contents: write | ||
steps: | ||
- name: Dependabot metadata | ||
id: dependabot-metadata | ||
uses: dependabot/[email protected] | ||
|
||
- name: Enable auto-merge for dependabot PRs | ||
run: gh pr merge --auto --rebase "$PR_URL" | ||
env: | ||
PR_URL: ${{ github.event.pull_request.html_url }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Approve patch and minor updates | ||
if: steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' || steps.dependabot-metadata.outputs.package-ecosystem == 'github-actions' | ||
run: gh pr review $PR_URL --approve -b "Pull request **approved** because **it includes a patch or minor update**" | ||
env: | ||
PR_URL: ${{ github.event.pull_request.html_url }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.