diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..cbe468a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,26 @@ +name: Release +on: + release: + types: [published] + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v3 + - name: Set up Java + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'adopt' + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@v1 + + - name: Determine new version + id: new_version + run: | + NEW_VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3) + echo "new_version=${NEW_VERSION}" >> $GITHUB_OUTPUT diff --git a/build.gradle b/build.gradle index abaa5a8..f1aa13f 100644 --- a/build.gradle +++ b/build.gradle @@ -29,11 +29,11 @@ def bumpVersionTo(version) { task setConventionalVersion() { doFirst { def nextVersion = se.bjurr.gitchangelog.api.GitChangelogApi.gitChangelogApiBuilder() - .withFromRepo(file('.')) - .withSemanticMajorVersionPattern("^[Bb]reak") - .withSemanticMinorVersionPattern("^[Ff]eat") - .getNextSemanticVersion() - .getVersion(); + .withFromRepo(file('.')) + .withSemanticMajorVersionPattern("^[Bb]reak") + .withSemanticMinorVersionPattern("^[Ff]eat") + .getNextSemanticVersion() + .getVersion(); def nextSnapshot = "${nextVersion}-SNAPSHOT" logger.lifecycle("Setting version ${nextSnapshot}...") bumpVersionTo(nextSnapshot)