Repository navigation
99 lines (78 loc) · 2.57 KB
/
Copy pathrelease-web.yml
File metadata and controls
99 lines (78 loc) · 2.57 KB
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
name: Build Web package
on:
release:
types: [published]
workflow_dispatch:
permissions:
contents: write
jobs:
build-web:
name: Build Web Distribution
runs-on: ubuntu-22.04
env:
APP_NAME: Java-Geometry-Expert
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Determine version
id: version
shell: bash
env:
RELEASE_TAG: ${{ github.event.release.tag_name || github.ref_name }}
run: |
VERSION="${RELEASE_TAG#v}"
if [[ -z "$VERSION" || "$VERSION" == "refs/heads/"* ]]; then
VERSION="$(git describe --tags --always 2>/dev/null || echo dev)"
VERSION="${VERSION#v}"
fi
VERSION="${VERSION//_/-}"
echo "value=$VERSION" >> "$GITHUB_OUTPUT"
echo "Building version: $VERSION"
- name: Set up Java 17
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: "17"
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v6
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y gettext zip
- name: Make Gradle wrapper executable
run: chmod +x ./gradlew
- name: Build Web distribution
run: |
./gradlew --no-daemon clean buildWeb \
"-PsoftwareVersion=${{ steps.version.outputs.value }}"
- name: Package web distribution into zip
shell: bash
env:
VERSION: ${{ steps.version.outputs.value }}
run: |
set -euo pipefail
if [ ! -d "build/web-dist" ]; then
echo "Directory build/web-dist not found!"
exit 1
fi
mkdir -p dist
# Package contents of build/web-dist without including the root folder name
ZIP_NAME="${APP_NAME}-${VERSION}-web.zip"
(cd build/web-dist && zip -r "../../dist/${ZIP_NAME}" ./*)
ls -lh dist/
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: web-dist
path: dist/*
if-no-files-found: error
- name: Upload package to GitHub Release
if: github.event_name == 'release'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.event.release.tag_name || github.ref_name }}
run: |
gh release view "$TAG" || gh release create "$TAG" --title "$TAG" --notes "Release $TAG"
gh release upload "$TAG" dist/* --clobber