fix: enhanced dsl and fixed maven version release #148
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
name: Publish | |
on: [ push ] | |
jobs: | |
infer-version: | |
name: Computing a new version | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.nyx-infer.outputs.version }} | |
newRelease: ${{ steps.nyx-infer.outputs.newRelease }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Run nyx Infer | |
id: nyx-infer | |
uses: mooltiverse/nyx-github-action@main | |
with: | |
command: 'infer' | |
configurationFile: '.nyx.json' | |
resume: 'true' | |
- name: Run nyx Make | |
uses: mooltiverse/nyx-github-action@main | |
with: | |
command: 'make' | |
configurationFile: '.nyx.json' | |
resume: 'true' | |
publish-version: | |
if: needs.infer-version.outputs.newRelease == 'true' | |
name: Publishing a new version | |
runs-on: ubuntu-latest | |
needs: infer-version | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 21 | |
distribution: adopt | |
- name: Cache Gradle packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | |
restore-keys: ${{ runner.os }}-gradle | |
- name: Strip the 'v' character from the version number | |
id: strip | |
run: echo "${{ needs.infer-version.outputs.version }}" | cut -c 2- | |
shell: bash | |
env: | |
OUTPUT: ${{ needs.infer-version.outputs.version }} | |
- name: Change wrapper permissions | |
run: chmod +x gradlew | |
- name: Run gradle publish (MavenCentral) | |
run: ./gradlew publishAllPublicationsToMavenCentralRepository --no-configuration-cache | |
env: | |
ORG_GRADLE_PROJECT_projectVersion: ${{ steps.strip.outputs.stripped }} | |
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} | |
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} | |
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }} | |
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }} | |
- name: Nyx publish (Github Release) | |
uses: mooltiverse/nyx-github-action | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NYX_RELEASE_TYPES_PUBLICATION_SERVICES: 'GITHUB' | |
NYX_SERVICES_GITHUB_NAME: 'GITHUB' | |
NYX_SERVICES_GITHUB_TYPE: 'GITHUB' | |
NYX_SERVICES_GITHUB_OPTIONS_AUTHENTICATION_TOKEN: "{{#environmentVariable}}GH_TOKEN{{/environmentVariable}}" | |
NYX_SERVICES_GITHUB_OPTIONS_REPOSITORY_NAME: 'webmonitor' | |
NYX_SERVICES_GITHUB_OPTIONS_REPOSITORY_OWNER: 'ennioVisco' | |
with: | |
command: 'publish' | |
configurationFile: '.nyx.json' | |
resume: 'true' | |
update-readme: | |
if: github.ref_name == 'master' | |
name: Updating README.md | |
runs-on: ubuntu-latest | |
needs: [ publish-version, infer-version ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Find and Replace | |
uses: jacobtomlinson/gha-find-replace@v3 | |
with: | |
find: com.enniovisco:webmonitor:\d+.\d+.\d+(-SNAPSHOT)? | |
replace: com.enniovisco:webmonitor:${{ needs.infer-version.outputs.version }} | |
include: "README.md" | |
- uses: fregante/setup-git-user@v2 | |
- name: Push changes | |
run: | | |
git add README.md | |
git commit -m "Updated README.md instructions with new package version" || true | |
git push || true |