-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add semanatic release setup #46
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,20 @@ | ||
name: Beta branch | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'beta' | ||
|
||
jobs: | ||
unit-test: | ||
uses: ./.github/workflows/job-test.yml | ||
|
||
check-new-version: | ||
needs: unit-test | ||
uses: ./.github/workflows/job-check-new-version.yml | ||
|
||
publish: | ||
needs: check-new-version | ||
if: ${{ needs.check-new-version.outputs.isNewVersion == 'true' }} | ||
uses: ./.github/workflows/job-publish.yml | ||
secrets: inherit | ||
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 @@ | ||
# Check if new version | ||
./gradlew checkIsNewVersion -q; newVersion=$? | ||
|
||
if [ $newVersion -ne 0 ]; then | ||
echo "isNewVersion=false" >> "$GITHUB_OUTPUT" | ||
else | ||
echo "isNewVersion=true" >> "$GITHUB_OUTPUT" | ||
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,28 @@ | ||
on: | ||
workflow_call: | ||
outputs: | ||
isNewVersion: | ||
description: "Indicates if this build generates a new version" | ||
value: ${{ jobs.check-new-version.outputs.isNewVersion }} | ||
|
||
jobs: | ||
check-new-version: | ||
name: Check new version | ||
runs-on: ubuntu-latest | ||
outputs: | ||
isNewVersion: ${{ steps.newVersion.outputs.isNewVersion }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 17 | ||
distribution: temurin | ||
cache: 'gradle' | ||
- name: Change wrapper permission | ||
run: chmod +x ./gradlew | ||
- id: newVersion | ||
name: Check new version | ||
run: ./.github/workflows/check-new-version.sh |
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,37 @@ | ||
on: | ||
workflow_call | ||
|
||
jobs: | ||
publish: | ||
name: Publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 17 | ||
distribution: temurin | ||
cache: 'gradle' | ||
- name: Change wrapper permission | ||
run: chmod +x ./gradlew | ||
|
||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 14.x | ||
|
||
- name: Create version tag | ||
run: ./gradlew :nyxMark | ||
|
||
- name: Publish Maven | ||
run: ./.github/workflows/publish-maven.sh | ||
env: | ||
OSSRH_USERNAME: ${{ secrets.SONATYPE_OSSRH_USERNAME }} | ||
OSSRH_PASSWORD: ${{ secrets.SONATYPE_OSSRH_PASSWORD }} | ||
|
||
- name: Publish NPMJS | ||
run: ./.github/workflows/publish-npm.sh | ||
env: | ||
NPMJS_TOKEN: ${{ secrets.DHIS2_BOT_NPM_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,19 @@ | ||
on: | ||
workflow_call | ||
|
||
jobs: | ||
unit-test: | ||
name: Run tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 17 | ||
distribution: temurin | ||
cache: 'gradle' | ||
- name: Change wrapper permission | ||
run: chmod +x ./gradlew | ||
- name: Test | ||
run: ./gradlew clean allTests |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
set -x | ||
|
||
branch=$(git rev-parse --abbrev-ref HEAD) | ||
|
||
if [ "$branch" = "main" ]; then | ||
./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository | ||
elif [ "$branch" = "beta" ]; then | ||
./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository -PbetaToSnapshot | ||
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,15 @@ | ||
set -x | ||
|
||
branch=$(git rev-parse --abbrev-ref HEAD) | ||
|
||
./gradlew packJsPackage | ||
cd build/packages/js || exit | ||
|
||
# Set authentication token for npmjs registry | ||
npm set //registry.npmjs.org/:_authToken="$NPMJS_TOKEN" | ||
|
||
if [ "$branch" = "main" ]; then | ||
npm publish | ||
elif [ "$branch" = "beta" ]; then | ||
npm publish --tag beta | ||
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two suggestions:
I think these changes could make the scripts easier to follow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the comment @kabaros.