-
-
Notifications
You must be signed in to change notification settings - Fork 182
149 lines (129 loc) · 5.73 KB
/
maven.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
139
140
141
142
143
144
145
146
147
148
149
name: Java CI with Maven
env:
# find out this value by opening https://api.github.com/repos/<owner>/<repo>/releases
# in your browser and copy the full "upload_url" value including the {?name,label} part
UPLOAD_URL: https://uploads.github.com/repos/MarginallyClever/Makelangelo-software/releases/54908875/assets{?name,label}
RELEASE_ID: 54908875 # same as above (id can just be taken out the upload_url, it's used to find old releases)
on:
push:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
# from https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
- name: Build and Test with Maven
timeout-minutes: 15
run: ./mvnw -B test -Djava.awt.headless=true
- name: Package with Maven
run: ./mvnw -B clean package -DskipTests
- name: Check files 1
run: ls -l src/main/package/
- name: Prepare universal package
shell: bash
run: |
mkdir -p target/universal-package &&
cp src/main/package/*.bat target/universal-package/ &&
cp src/main/package/start* target/universal-package/ &&
cp src/main/package/thankyou.* target/universal-package/ &&
cp CONTRIBUTING.md target/universal-package/ &&
cp LICENSE target/universal-package/ &&
cp README.md target/universal-package/ &&
cp target/Makelangelo-*-with-dependencies.jar target/universal-package/ &&
cd target/universal-package/ &&
7z a -tzip Makelangelo.zip . &&
mv Makelangelo.zip ../..
- name: Prepare target/package for upload
shell: bash
run: |
mkdir -p target/package &&
cp src/main/package/*.bat target/package/ &&
cp src/main/package/start* target/package/ &&
cp src/main/package/thankyou.* target/package/ &&
cp CONTRIBUTING.md target/package/ &&
cp LICENSE target/package/ &&
cp README.md target/package/
- name: Check files 2a
run: ls -l target/universal-package/
- name: Check files 2b
run: ls -l target/package/
- name: Deploy universal release
if: github.repository == 'MarginallyClever/Makelangelo-software' && github.ref == 'refs/heads/master'
uses: WebFreak001/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # automatically provided by github actions
with:
upload_url: ${{ env.UPLOAD_URL }}
release_id: ${{ env.RELEASE_ID }}
asset_path: Makelangelo.zip # path to archive to upload
asset_name: Makelangelo-nightly-$$.zip # name to upload the release as, use $$ to insert date (YYYYMMDD) and 6 letter commit hash
asset_content_type: application/zip # required by GitHub API
max_releases: 1 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted
- name: Upload artifact for package
uses: actions/[email protected]
with:
name: jar
retention-days: 1
path: |
src/main/package/jpackage*
src/main/package/logo*
LICENSE
README
target/package/*
- name: Check files 3
run: ls -l target/universal-package/
package:
needs: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- uses: actions/[email protected]
with:
name: jar
- name: Check files 4
run: ls -l target/package/
- name: Build installation package
shell: bash
run: |
set -x
set -o pipefail
APP_VERSION=$(ls -1 target/package/Makelangelo-*-with-dependencies.jar | sed "s/.*Makelangelo-\([^-]*\)-with-dependencies.jar/\1/") &&
sed -i.bak "s/\(--app-version\).*/\1 $APP_VERSION/" src/main/package/jpackage.cfg &&
jpackage "@src/main/package/jpackage.cfg" "@src/main/package/jpackage-${{matrix.os}}.cfg" --main-jar "Makelangelo-$APP_VERSION-with-dependencies.jar" &&
ls &&
BINARY=$(find . -maxdepth 1 -iname 'makelangelo*' | grep -E '(msi$|dmg$|deb$)' | sed "s,./,," | head -1) &&
BINARY_NIGHTLY=$(echo $BINARY | sed 's/[Mm]akelangelo\(.*\)\.\(.*\)/\Makelangelo-nightly-$$.\2/') &&
echo "BINARY=$BINARY" | tee -a $GITHUB_ENV &&
echo "BINARY_NIGHTLY=$BINARY_NIGHTLY" | tee -a $GITHUB_ENV
- name: Deploy installation release
# if: github.repository == 'MarginallyClever/Makelangelo-software'
# if: github.repository == 'MarginallyClever/Makelangelo-software' && github.ref == 'refs/heads/master'
uses: WebFreak001/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # automatically provided by github actions
with:
upload_url: ${{ env.UPLOAD_URL }}
release_id: ${{ env.RELEASE_ID }}
asset_path: ${{ env.BINARY }} # path to archive to upload
asset_name: ${{ env.BINARY_NIGHTLY }} # name to upload the release as, use $$ to insert date (YYYYMMDD) and 6 letter commit hash
asset_content_type: application/zip # required by GitHub API
max_releases: 1 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted
- name: Upload artifact for testing purpose
# if: github.repository == 'MarginallyClever/Makelangelo-software' || github.ref != 'refs/heads/master'
uses: actions/[email protected]
with:
name: ${{ env.BINARY }}
retention-days: 2
path: ${{ env.BINARY }}