[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: matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ] os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
env: if: startsWith(github.event.head_commit.message, 'Releasing version') != true
CI: true
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2

View File

@@ -7,7 +7,7 @@ on:
jobs: jobs:
earlyaccess: earlyaccess:
name: "Early Access" 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 runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout

View File

@@ -34,10 +34,19 @@ jobs:
restore-keys: | restore-keys: |
${{ runner.os }}-gradlew- ${{ 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 - name: Build
run: | run: |
./gradlew -Pversion=${{ github.event.inputs.version }} \ ./gradlew -Prelease=true build -S
-Prelease=true build -S
- name: Deploy - name: Deploy
env: env:
@@ -47,8 +56,7 @@ jobs:
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }} GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }}
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }} GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }}
run: | run: |
./gradlew -Pversion=${{ github.event.inputs.version }} \ ./gradlew -Prelease=true -Pfull-release=true \
-Prelease=true -Pfull-release=true \
-PsonatypeUsername=${{ secrets.SONATYPE_USERNAME }} \ -PsonatypeUsername=${{ secrets.SONATYPE_USERNAME }} \
-PsonatypePassword=${{ secrets.SONATYPE_PASSWORD }} \ -PsonatypePassword=${{ secrets.SONATYPE_PASSWORD }} \
build publishToSonatype publishPlugins -S build publishToSonatype publishPlugins -S

1
.gitignore vendored
View File

@@ -11,4 +11,3 @@ target/
tmp/ tmp/
.DS_Store .DS_Store
.tmp .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 compression = Compression.GZIP
} }
task versionFile {
doLast {
project.layout.buildDirectory.file('VERSION').get().asFile.text = project.version
}
}
classes.dependsOn(versionFile)
distributions { distributions {
main { main {
contents { contents {
from('build') { from('../..') {
include 'VERSION' include 'VERSION'
} }
} }

View File

@@ -15,6 +15,13 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
project.rootProject.ext.theVersion = file('VERSION').text.trim()
allprojects { p ->
p.version = p.rootProject.ext.theVersion
}
config { config {
info { info {
description = 'jreleaser' description = 'jreleaser'
@@ -86,5 +93,3 @@ subprojects {
useJUnitPlatform() useJUnitPlatform()
} }
} }
new File('VERSION').text = project.version

View File

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