-
Notifications
You must be signed in to change notification settings - Fork 33
138 lines (134 loc) · 6.47 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Release
# Runs manually
on:
workflow_dispatch
jobs:
# Adjusts the revision to the latest version, builds images for each OS type/architecture using matrix:os and uploads each binary as a separate artifact
build-natives:
name: Build native images
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ windows-latest, ubuntu-latest, macos-latest, macos-13 ]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: graalvm/setup-graalvm@v1
with:
java-version: '21.0.2'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'true'
- name: Build native image
shell: bash
run: |
maven_config="$(cat .mvn/maven.config)"
current_version="${maven_config/#*-Drevision=}"
current_version="${current_version/ */}"
next_version="${current_version/-SNAPSHOT/}"
cd cli
mvn -B -ntp -Drevision=${next_version} -Pnative -DskipTests=true package
- name: Upload native image
uses: actions/upload-artifact@v4
with:
name: natives-${{ matrix.os }}
path: cli/target/ideasy*
- name: Build MSI with WixToolSet
if: runner.os == 'Windows'
shell: bash
run: |
cd documentation
mvn -B -ntp clean install
cd ..
mkdir -p windows-installer/msi-files
cp documentation/target/generated-docs/IDEasy.pdf windows-installer/msi-files
cp -r cli/target/package/* windows-installer/msi-files
rm -rf windows-installer/msi-files/system/mac
rm -rf windows-installer/msi-files/system/linux
cp cli/target/ideasy.exe windows-installer/msi-files/bin
cd windows-installer
dotnet tool install --global wix --version 5.0.2
wix extension add WixToolset.UI.wixext/5.0.2
wix extension add WixToolset.Util.wixext/5.0.2
wix build Package.wxs WixUI_IDEasySetup.wxs -loc Package.en-us.wxl -ext WixToolset.UI.wixext -ext WixToolset.Util.wixext -o ideasy.msi
- name: Upload MSI
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: msi
path: windows-installer/ideasy.msi
# Downloads all native image artifacts to cli/target and builds the project using assemblies for final deployment to Maven Central.
# The version number for the next build will be incremented automatically.
# A GitHub release and download URLs pointing to the respective OS/architecture archives on Maven Central will be created.
release:
name: Release on Sonatype OSS
runs-on: ubuntu-latest
needs: build-natives
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.ACTION_PUSH_TOKEN }}
- name: Set up Apache Maven Central
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
cache: 'maven'
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: GPG_PASSPHRASE # env variable for GPG private key passphrase
- name: Download natives and build project
uses: actions/download-artifact@v4
with:
path: ./cli/target/
- name: Create assemblies and publish to Apache Maven Central
run: |
maven_config="$(cat .mvn/maven.config)"
current_version="${maven_config/#*-Drevision=}"
current_version="${current_version/ */}"
next_version="${current_version/-SNAPSHOT/}"
sed -i "s/${current_version}/${next_version}/" .mvn/maven.config
git config --global user.email ${{ secrets.BUILD_USER_EMAIL }}
git config --global user.name ${{ secrets.BUILD_USER }}
git add -f .mvn/maven.config
git commit -m "set release version to ${next_version}"
git tag -a "release/${next_version}" -m "tagged version ${next_version}"
export GPG_TTY=$TTY
mkdir -p ./cli/target/
mvn --settings .mvn/settings.xml -B -ntp deploy -Passembly,msi,deploy -Dgpg.pin.entry.mode=loopback -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }}
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: set next version & create gitHub release
run: |
maven_config="$(cat .mvn/maven.config)"
current_version="${maven_config/#*-Drevision=}"
current_version="${current_version/ */}"
current_segment="${current_version/*./}"
last_digits="${current_segment/[^0-9]*/}"
suffix="${current_segment/${last_digits}/}"
(( next_segment=${last_digits}+1 ))
while [ ${#next_segment} -lt 3 ]; do next_segment="0${next_segment}"; done
next_version="${current_version%.*}.${next_segment}${suffix}-SNAPSHOT"
sed -i "s/${current_version}/${next_version}/" .mvn/maven.config
git add -f .mvn/maven.config
git commit -m "set next version to ${next_version}"
# prevent GH006 error when pushing to protected branch
git push
git push --tags
noDotVersion="${current_version//.}"
gh release create "release/${current_version}" ./cli/target/*.tar.gz --title "${current_version}" --notes "# Download
* Windows-MSI: https://repo1.maven.org/maven2/com/devonfw/tools/IDEasy/ide-cli/${current_version}/ide-cli-${current_version}.msi
* Windows: https://repo1.maven.org/maven2/com/devonfw/tools/IDEasy/ide-cli/${current_version}/ide-cli-${current_version}-windows-x64.tar.gz
* Mac(arm): https://repo1.maven.org/maven2/com/devonfw/tools/IDEasy/ide-cli/${current_version}/ide-cli-${current_version}-mac-arm.tar.gz
* Mac(x64): https://repo1.maven.org/maven2/com/devonfw/tools/IDEasy/ide-cli/${current_version}/ide-cli-${current_version}-mac-x64.tar.gz
* Linux: https://repo1.maven.org/maven2/com/devonfw/tools/IDEasy/ide-cli/${current_version}/ide-cli-${current_version}-linux-x64.tar.gz
# Changes
https://github.com/devonfw/IDEasy/blob/main/CHANGELOG.adoc#${noDotVersion/-beta/}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_USER: ${{ secrets.BUILD_USER }}
BUILD_USER_PASSWD: ${{ secrets.BUILD_USER_PASSWD }}