Repository navigation
134 lines (108 loc) · 3.53 KB
/
Copy pathrelease-linux.yml
File metadata and controls
134 lines (108 loc) · 3.53 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
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
name: Build Linux packages
on:
release:
types: [published]
workflow_dispatch:
permissions:
contents: write
jobs:
build-linux:
name: Build Linux (${{ matrix.arch }})
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
runner: ubuntu-22.04
java_arch: x86_64
- arch: arm64
runner: ubuntu-24.04-arm
java_arch: aarch64
runs-on: ${{ matrix.runner }}
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
# Use a Debian/RPM-safe version string.
VERSION="${VERSION//_/-}"
echo "value=$VERSION" >> "$GITHUB_OUTPUT"
echo "Building version: $VERSION"
- name: Install packaging dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
openjdk-11-jdk gettext
- name: Make Gradle wrapper executable
run: chmod +x ./gradlew
- name: Build AppImage, DEB, and RPM
run: |
./gradlew --no-daemon clean package \
"-PsoftwareVersion=${{ steps.version.outputs.value }}"
- name: Collect and normalize artifacts
shell: bash
env:
VERSION: ${{ steps.version.outputs.value }}
ARCH: ${{ matrix.arch }}
run: |
set -euo pipefail
mkdir -p dist
shopt -s nullglob
appimages=(build/*.AppImage)
debs=(build/*.deb)
rpms=(build/*.rpm)
if (( ${#appimages[@]} != 1 )); then
echo "Expected one AppImage; found ${#appimages[@]}"
find build -maxdepth 2 -type f
exit 1
fi
if (( ${#debs[@]} != 1 )); then
echo "Expected one DEB; found ${#debs[@]}"
find build -maxdepth 2 -type f
exit 1
fi
if (( ${#rpms[@]} != 1 )); then
echo "Expected one RPM; found ${#rpms[@]}"
find build -maxdepth 2 -type f
exit 1
fi
cp "${appimages[0]}" \
"dist/${APP_NAME}-${VERSION}-${ARCH}.AppImage"
cp "${debs[0]}" \
"dist/${APP_NAME}-${VERSION}-${ARCH}.deb"
cp "${rpms[0]}" \
"dist/${APP_NAME}-${VERSION}-${ARCH}.rpm"
chmod +x "dist/${APP_NAME}-${VERSION}-${ARCH}.AppImage"
ls -lh dist/
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: linux-${{ matrix.arch }}
path: dist/*
if-no-files-found: error
- name: Upload packages to GitHub Release
if: github.event_name == 'release'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.event.release.tag_name }}
ARCH: ${{ matrix.arch }}
VERSION: ${{ steps.version.outputs.value }}
run: |
gh release upload "$TAG" \
"dist/${APP_NAME}-${VERSION}-${ARCH}.AppImage" \
"dist/${APP_NAME}-${VERSION}-${ARCH}.deb" \
"dist/${APP_NAME}-${VERSION}-${ARCH}.rpm" \
--clobber