-
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.
Browse files
Browse the repository at this point in the history
#4 Add automated releases and publishing
- Loading branch information
Showing
11 changed files
with
160 additions
and
44 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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# This hook checks the commit message (header only) to ensure that the expected format is used. | ||
# | ||
# Commits with breaking changes should include 'BREAKING CHANGE: <some description>' in the commit body with a description (Note: this is not validated by the hook). | ||
# | ||
|
||
commit_regex='^((build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([a-zA-Z0-9 /_,.-]+?\))?: .{1,79}\w|Merge .+|(fixup|squash)! .+)$' | ||
|
||
error_msg=' | ||
---------------------------------------------------- | ||
ABORTING commit - Expecting a conventional commit message header: | ||
<type>[(optional scope)]: <summary - MAX 80 chars> | ||
---------------------------------------------------- | ||
Examples: | ||
1. | ||
fix(cache): Fix nasty caching bug (#123) | ||
2. | ||
feat: Enable awesome feature (#456) | ||
3. | ||
chore: Cleanup code to reduce maintenance cost | ||
<newline> | ||
BREAKING CHANGE: Deprecated feature xyz finally removed | ||
<newline> | ||
[optional footer] | ||
---------------------------------------------------- | ||
Accepted Types: | ||
build - for changes that affect the build or external dependencies | ||
chore - for general maintenance changes | ||
ci - for changes related to the ci pipeline | ||
docs - for documentation changes | ||
feat - for features [* triggers a MINOR release when pushed] | ||
fix - for fixes [* triggers a PATCH release when pushed] | ||
perf - for performance related changes | ||
refactor - for refactoring | ||
revert - for revert commits | ||
style - for style changes | ||
test - for adding or updating tests | ||
---------------------------------------------------- | ||
Exceptions: | ||
fixup! ... | ||
squash! ... | ||
Merge ... | ||
' | ||
|
||
if ! grep -iqE "${commit_regex}" "$1"; then | ||
echo "${error_msg}" >&2 | ||
exit 1 | ||
fi |
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,47 @@ | ||
# This workflow will build a Java project with Gradle then perform an automated release | ||
# For more information see: | ||
# https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle | ||
# https://github.com/marketplace/actions/action-for-semantic-release | ||
|
||
name: CI | ||
on: [ push, pull_request ] | ||
jobs: | ||
build: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '11' | ||
distribution: 'adopt' | ||
- name: Build with Gradle | ||
run: ./gradlew build | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: build-directory | ||
path: build | ||
- uses: codecov/codecov-action@v1 | ||
with: | ||
files: build/reports/jacoco/test/jacocoTestReport.xml | ||
verbose: true | ||
release: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Semantic Release | ||
uses: cycjimmy/semantic-release-action@v2 | ||
id: semantic | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Publish to Sonatype | ||
if: steps.semantic.outputs.new_release_published == 'true' | ||
env: | ||
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }} | ||
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} | ||
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} | ||
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} | ||
run: | | ||
./gradlew publishToSonatype closeAndReleaseStagingRepository |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: Nightly Build | ||
on: | ||
schedule: | ||
- cron: '0 2 * * *' # run at 2 AM UTC | ||
jobs: | ||
build: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '11' | ||
distribution: 'adopt' | ||
- name: Build with Gradle | ||
run: ./gradlew build |
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,9 @@ | ||
# See: | ||
# https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#configuration | ||
# https://github.com/marketplace/actions/action-for-semantic-release | ||
|
||
branches: ["master", "main"] | ||
plugins: | ||
- "@semantic-release/commit-analyzer" | ||
- "@semantic-release/release-notes-generator" | ||
- "@semantic-release/github" |
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 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 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,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
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,8 @@ | ||
|
||
task installGitHooks() { | ||
shouldRunAfter("clean") | ||
println "-- Configuring git to use .githooks --" | ||
project.exec { | ||
commandLine('git', 'config', 'core.hooksPath', '.githooks') | ||
} | ||
} |
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