-
Notifications
You must be signed in to change notification settings - Fork 17
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 #123 from dhis2/semantic-release
feat!: semantic release setup
- Loading branch information
Showing
14 changed files
with
233 additions
and
106 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,39 @@ | ||
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 tag and publish Github release | ||
run: ./gradlew :nyxPublish | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- 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,40 +1,22 @@ | ||
name: Run tests | ||
name: Main | ||
|
||
on: [pull_request] | ||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
- 'master' | ||
- 'beta' | ||
|
||
jobs: | ||
unit-test: | ||
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 | ||
uses: ./.github/workflows/job-test.yml | ||
|
||
artifact: | ||
name: Publish - Nexus | ||
runs-on: ubuntu-latest | ||
check-new-version: | ||
needs: unit-test | ||
uses: ./.github/workflows/job-check-new-version.yml | ||
|
||
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: Release Maven package | ||
run: ./gradlew publishAllPublicationsToSonatypeRepository | ||
env: | ||
OSSRH_USERNAME: ${{ secrets.SONATYPE_OSSRH_USERNAME }} | ||
OSSRH_PASSWORD: ${{ secrets.SONATYPE_OSSRH_PASSWORD }} | ||
publish: | ||
needs: check-new-version | ||
if: ${{ needs.check-new-version.outputs.isNewVersion == 'true' }} | ||
uses: ./.github/workflows/job-publish.yml | ||
secrets: inherit |
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,7 @@ | ||
name: Pull request | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
unit-test: | ||
uses: ./.github/workflows/job-test.yml |
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" ] || [ "$branch" = "master" ]; 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,17 @@ | ||
set -x | ||
|
||
branch=$(git rev-parse --abbrev-ref HEAD) | ||
|
||
./gradlew packJsPackage | ||
./gradlew packJsPackage -PuseCommonJs | ||
|
||
cd build/packages/js || exit | ||
|
||
# Set authentication token for npmjs registry | ||
npm set //registry.npmjs.org/:_authToken="$NPMJS_TOKEN" | ||
|
||
if [ "$branch" = "main" ] || [ "$branch" = "master" ]; 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
# starting from the "simple" preset gives us: | ||
# - the Conventional Commits convention | ||
preset: "simple" | ||
changelog: | ||
path: "CHANGELOG.md" | ||
sections: | ||
"Added": "^feat$" | ||
"Fixed": "^fix$" | ||
releaseTypes: | ||
enabled: | ||
- mainline | ||
- maturity | ||
- internal | ||
publicationServices: | ||
- github | ||
items: | ||
mainline: | ||
description: "{{#fileContent}}CHANGELOG.md{{/fileContent}}" | ||
filterTags: "^({{configuration.releasePrefix}})?([0-9]\\d*)\\.([0-9]\\d*)\\.([0-9]\\d*)$" | ||
gitPush: "true" | ||
gitTag: "true" | ||
matchBranches: "^(master|main)$" | ||
matchEnvironmentVariables: | ||
CI: "^true$" | ||
matchWorkspaceStatus: "CLEAN" | ||
publish: "true" | ||
maturity: | ||
description: "{{#fileContent}}CHANGELOG.md{{/fileContent}}" | ||
collapseVersions: true | ||
collapsedVersionQualifier: "{{#sanitizeLower}}{{branch}}{{/sanitizeLower}}" | ||
filterTags: "^({{configuration.releasePrefix}})?([0-9]\\d*)\\.([0-9]\\d*)\\.([0-9]\\d*)(-(alpha|beta)(\\.([0-9]\\d*))?)?$" | ||
gitPush: "true" | ||
gitTag: "true" | ||
matchBranches: "^(alpha|beta)$" | ||
matchEnvironmentVariables: | ||
CI: "^true$" | ||
matchWorkspaceStatus: "CLEAN" | ||
publish: "true" | ||
publishPreRelease: "true" | ||
internal: | ||
collapseVersions: true | ||
collapsedVersionQualifier: "internal" | ||
gitPush: "false" | ||
gitTag: "false" | ||
identifiers: | ||
- | ||
qualifier: "{{#timestampYYYYMMDDHHMMSS}}{{timestamp}}{{/timestampYYYYMMDDHHMMSS}}" | ||
position: "BUILD" | ||
publish: "false" | ||
services: | ||
github: | ||
type: "GITHUB" | ||
options: | ||
AUTHENTICATION_TOKEN: "{{#environmentVariable}}GH_TOKEN{{/environmentVariable}}" | ||
REPOSITORY_NAME: "dhis2-rule-engine" | ||
REPOSITORY_OWNER: "dhis2" |
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.