-
Notifications
You must be signed in to change notification settings - Fork 4
86 lines (79 loc) · 2.81 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Release
on:
pull_request:
branches: [ master ]
types: [ closed ]
jobs:
build:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
env:
GITHUB_USER: personiumio
GITHUB_TOKEN: ${{ secrets.PERSONIUM_GITHUB_TOKEN }}
steps:
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: git settings
run: |
if [ -z "$GITHUB_USER" -o -z "$GITHUB_TOKEN" ]; then
echo '$GITHUB_USER or $GITHUB_TOKEN is empty.'
exit 1
fi
cat << EOS >~/.netrc
machine github.com
login $GITHUB_USER
password $GITHUB_TOKEN
EOS
git config --global user.name "Personium Bot"
git config --global user.email "[email protected]"
git clone https://github.com/${GITHUB_REPOSITORY}.git .
git checkout master
- name: Get Component Name
run: |
echo "COMPONENT=$(echo $GITHUB_REPOSITORY | awk -F '/' '{ print $2 }')" >> $GITHUB_ENV
- name: Remove -SNAPSHOT from pom.xml, and get version string which is to be released.
run: |
sed -i 's|\-SNAPSHOT||' pom.xml
echo "RELEASE_VERSION=$(mvn -B help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: Get extension of artifact
run: |
echo "EXT_PACKAGING=$(mvn -B help:evaluate -Dexpression=project.packaging -q -DforceStdout)" >> $GITHUB_ENV
- name: Commit and push
run: |
git add pom.xml
git commit -m "Update to v${RELEASE_VERSION}"
git push origin master
- name: Create Release Note
run: |
awk '/##/{i++}i==1' CHANGELOG.md | tail +2 > ${{ github.workflow }}_CHANGELOG.md
- name: Build with maven
run: |
mvn -B package --file pom.xml -DskipTests
- name: Create Release
uses: softprops/action-gh-release@v1
with:
name: "Release v${{ env.RELEASE_VERSION }}"
tag_name: "v${{ env.RELEASE_VERSION }}"
body_path: ${{ github.workflow }}_CHANGELOG.md
draft: true
files: |
target/*.${{ env.EXT_PACKAGING }}
prerelease: false
target_commitish: master
- name: Delete Temporary Release Note
run: rm ${{ github.workflow }}_CHANGELOG.md
- name: Prepare develop branch
run: |
git checkout develop
git rebase master
- name: Set next -SNAPSHOT version, and get next version string.
run: |
mvn -B versions:set -DnextSnapshot && mvn -B versions:commit
echo "NEXT_SNAPSHOT_VERSION=$(mvn -B help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: Update versions on develop branch
run: |
git add pom.xml
git commit -m "Update to v${NEXT_SNAPSHOT_VERSION}"
git push origin develop