diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8147a34c..9f595120 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,8 +13,8 @@ jobs: matrix: os: [ ubuntu-latest, macos-latest, windows-latest ] runs-on: ${{ matrix.os }} - env: - CI: true + if: startsWith(github.event.head_commit.message, 'Releasing version') != true + steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/early-access.yml b/.github/workflows/early-access.yml index e7358f52..14b360fc 100644 --- a/.github/workflows/early-access.yml +++ b/.github/workflows/early-access.yml @@ -7,7 +7,7 @@ on: jobs: earlyaccess: name: "Early Access" - if: github.repository == 'jreleaser/jreleaser' + if: github.repository == 'jreleaser/jreleaser' && startsWith(github.event.head_commit.message, 'Releasing version') != true runs-on: ubuntu-latest steps: - name: Checkout diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bc44987e..907afa46 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,10 +34,19 @@ jobs: restore-keys: | ${{ runner.os }}-gradlew- + - name: Set release version + run: | + VERSION=${{ github.event.inputs.version }} + echo $VERSION > VERSION + git add VERSION + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" + git config --global user.name "GitHub Action" + git commit -a -m "Releasing version $VERSION" + git push origin main + - name: Build run: | - ./gradlew -Pversion=${{ github.event.inputs.version }} \ - -Prelease=true build -S + ./gradlew -Prelease=true build -S - name: Deploy env: @@ -47,8 +56,7 @@ jobs: GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }} GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }} run: | - ./gradlew -Pversion=${{ github.event.inputs.version }} \ - -Prelease=true -Pfull-release=true \ + ./gradlew -Prelease=true -Pfull-release=true \ -PsonatypeUsername=${{ secrets.SONATYPE_USERNAME }} \ -PsonatypePassword=${{ secrets.SONATYPE_PASSWORD }} \ build publishToSonatype publishPlugins -S diff --git a/.gitignore b/.gitignore index 22a45149..88048b5e 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,3 @@ target/ tmp/ .DS_Store .tmp -VERSION diff --git a/VERSION b/VERSION new file mode 100644 index 00000000..daf2bb73 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.3.0-SNAPSHOT diff --git a/apps/jreleaser/jreleaser.gradle b/apps/jreleaser/jreleaser.gradle index 38aa3fa3..c59d0cc8 100644 --- a/apps/jreleaser/jreleaser.gradle +++ b/apps/jreleaser/jreleaser.gradle @@ -62,18 +62,10 @@ tasks.withType(Tar){ compression = Compression.GZIP } -task versionFile { - doLast { - project.layout.buildDirectory.file('VERSION').get().asFile.text = project.version - } -} - -classes.dependsOn(versionFile) - distributions { main { contents { - from('build') { + from('../..') { include 'VERSION' } } diff --git a/build.gradle b/build.gradle index 5e580e74..ac14b889 100644 --- a/build.gradle +++ b/build.gradle @@ -15,6 +15,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +project.rootProject.ext.theVersion = file('VERSION').text.trim() + +allprojects { p -> + p.version = p.rootProject.ext.theVersion +} + config { info { description = 'jreleaser' @@ -85,6 +92,4 @@ subprojects { test { useJUnitPlatform() } -} - -new File('VERSION').text = project.version \ No newline at end of file +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 22bd7ed1..56545dd0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,6 @@ # group = org.jreleaser -version = 0.3.0-SNAPSHOT sourceCompatibility = 1.8 targetCompatibility = 1.8