Skip to content

Commit d12beeb

Browse files
Enhacen release.yml
1 parent 85fd30d commit d12beeb

File tree

1 file changed

+5
-60
lines changed

1 file changed

+5
-60
lines changed

.github/workflows/release.yml

Lines changed: 5 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -11,81 +11,27 @@ on:
1111
required: false
1212

1313
jobs:
14-
version:
14+
release:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/checkout@v3
1818
with:
1919
fetch-depth: 0
20-
- uses: actions/setup-java@v3
21-
with:
22-
java-version: 11
23-
distribution: temurin
24-
cache: maven
2520
- name: Set release version
26-
id: version
21+
env:
22+
RELEASE_VERSION: ${{ inputs.version }}
2723
run: |
28-
RELEASE_VERSION=${{ github.event.inputs.version }}
29-
NEXT_VERSION=${{ github.event.inputs.next }}
30-
PLAIN_VERSION=`echo ${RELEASE_VERSION} | awk 'match($0, /^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)/) { print substr($0, RSTART, RLENGTH); }'`
31-
COMPUTED_NEXT_VERSION="${PLAIN_VERSION}-SNAPSHOT"
32-
if [ -z $NEXT_VERSION ]
33-
then
34-
NEXT_VERSION=$COMPUTED_NEXT_VERSION
35-
fi
3624
mvn -B versions:set versions:commit -DnewVersion=$RELEASE_VERSION
3725
git config --global user.email "[email protected]"
3826
git config --global user.name "Project-Openubl Bot"
3927
git commit --allow-empty -a -m "🏁 Releasing version $RELEASE_VERSION"
4028
git push origin HEAD:master
41-
git rev-parse HEAD > HEAD
42-
echo $RELEASE_VERSION > RELEASE_VERSION
43-
echo $PLAIN_VERSION > PLAIN_VERSION
44-
echo $NEXT_VERSION > NEXT_VERSION
45-
- name: Upload version files
46-
uses: actions/upload-artifact@v3
47-
with:
48-
name: artifacts
49-
path: |
50-
HEAD
51-
*_VERSION
52-
53-
release:
54-
needs: [ version ]
55-
runs-on: ubuntu-latest
56-
steps:
57-
- uses: actions/download-artifact@v3
58-
with:
59-
name: artifacts
60-
path: artifacts
61-
- name: Read HEAD ref
62-
id: head
63-
uses: juliangruber/read-file-action@v1
64-
with:
65-
path: artifacts/HEAD
66-
- name: Read versions
67-
id: version
68-
run: |
69-
RELEASE_VERSION=`cat artifacts/RELEASE_VERSION`
70-
PLAIN_VERSION=`cat artifacts/PLAIN_VERSION`
71-
NEXT_VERSION=`cat artifacts/NEXT_VERSION`
72-
echo "RELEASE_VERSION = $RELEASE_VERSION"
73-
echo "PLAIN_VERSION = $PLAIN_VERSION"
74-
echo "NEXT_VERSION = $NEXT_VERSION"
75-
echo "::set-output name=RELEASE_VERSION::$RELEASE_VERSION"
76-
echo "::set-output name=PLAIN_VERSION::$PLAIN_VERSION"
77-
echo "::set-output name=NEXT_VERSION::$NEXT_VERSION"
78-
- uses: actions/checkout@v3
79-
with:
80-
ref: ${{ steps.head.outputs.content }}
81-
fetch-depth: 0
8229
8330
# OSSRH
8431
- uses: actions/setup-java@v3
8532
with:
8633
distribution: "temurin"
8734
java-version: 11
88-
cache: maven
8935
server-id: ossrh
9036
server-username: MAVEN_USERNAME
9137
server-password: MAVEN_PASSWORD
@@ -103,7 +49,6 @@ jobs:
10349
with:
10450
distribution: "temurin"
10551
java-version: 11
106-
cache: maven
10752
gpg-private-key: ${{ secrets.gpg_private_key }}
10853
gpg-passphrase: MAVEN_GPG_PASSPHRASE
10954
- name: GitHub Release
@@ -116,7 +61,7 @@ jobs:
11661
uses: jreleaser/release-action@v2
11762
env:
11863
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
119-
JRELEASER_PROJECT_VERSION: ${{ steps.version.outputs.RELEASE_VERSION }}
64+
JRELEASER_PROJECT_VERSION: ${{ inputs.version }}
12065
JRELEASER_ZULIP_API_KEY: ${{ secrets.JRELEASER_ZULIP_API_KEY }}
12166
JRELEASER_TWITTER_CONSUMER_KEY: ${{ secrets.JRELEASER_TWITTER_CONSUMER_KEY }}
12267
JRELEASER_TWITTER_CONSUMER_SECRET: ${{ secrets.JRELEASER_TWITTER_CONSUMER_SECRET }}
@@ -127,7 +72,7 @@ jobs:
12772

12873
- name: Set next version
12974
env:
130-
NEXT_VERSION: ${{ steps.version.outputs.NEXT_VERSION }}
75+
NEXT_VERSION: ${{ inputs.next }}
13176
run: |
13277
mvn -B versions:set versions:commit -DnewVersion=$NEXT_VERSION
13378
git config --global user.email "[email protected]"

0 commit comments

Comments
 (0)