-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from dhis2/semantic-release
feat: add semanatic release setup
- Loading branch information
Showing
12 changed files
with
152 additions
and
52 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,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@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
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/scripts/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@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: 17 | ||
distribution: temurin | ||
cache: 'gradle' | ||
- name: Change wrapper permission | ||
run: chmod +x ./gradlew | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 14.x | ||
|
||
- name: Create version tag | ||
run: ./gradlew :nyxMark | ||
|
||
- name: Publish Maven | ||
run: ./.github/workflows/scripts/publish-maven.sh | ||
env: | ||
OSSRH_USERNAME: ${{ secrets.SONATYPE_OSSRH_USERNAME }} | ||
OSSRH_PASSWORD: ${{ secrets.SONATYPE_OSSRH_PASSWORD }} | ||
|
||
- name: Publish NPMJS | ||
run: ./.github/workflows/scripts/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@v4 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,21 @@ | ||
name: Run tests | ||
name: Main | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
- 'beta' | ||
|
||
jobs: | ||
unit-test: | ||
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 | ||
publish: | ||
name: Publish - Nexus | ||
runs-on: ubuntu-latest | ||
uses: ./.github/workflows/job-test.yml | ||
|
||
check-new-version: | ||
needs: unit-test | ||
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: Release Maven package | ||
run: ./gradlew publishAllPublicationsToSonatypeRepository | ||
env: | ||
OSSRH_USERNAME: ${{ secrets.SONATYPE_OSSRH_USERNAME }} | ||
OSSRH_PASSWORD: ${{ secrets.SONATYPE_OSSRH_PASSWORD }} | ||
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
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,9 @@ | ||
set -x | ||
|
||
branch=$(git rev-parse --abbrev-ref HEAD) | ||
|
||
if [ "$branch" = "main" ]; then | ||
./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository | ||
elif [ "$branch" = "beta" ]; then | ||
./gradlew publishToSonatype -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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ project.afterEvaluate { | |
"publishConfig" by { | ||
"access" by "public" | ||
} | ||
"private" by false | ||
} | ||
} | ||
} | ||
|
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