[chore] Update how version is set

This commit is contained in:
Andres Almiray
2021-04-24 22:53:36 +02:00
parent ab54e034f6
commit 253e16d4aa
8 changed files with 25 additions and 21 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

1
.gitignore vendored
View File

@@ -11,4 +11,3 @@ target/
tmp/
.DS_Store
.tmp
VERSION

1
VERSION Normal file
View File

@@ -0,0 +1 @@
0.3.0-SNAPSHOT

View File

@@ -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'
}
}

View File

@@ -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
}

View File

@@ -17,7 +17,6 @@
#
group = org.jreleaser
version = 0.3.0-SNAPSHOT
sourceCompatibility = 1.8
targetCompatibility = 1.8