Skip to content

Commit eda0132

Browse files
authored
build linux release files via github
1 parent 6f76202 commit eda0132

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: build release for linux
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build-and-release:
8+
strategy:
9+
matrix:
10+
node-version: [22.x]
11+
os: [ubuntu-24.04, ubuntu-24.04-arm]
12+
runs-on: ${{ matrix.os }}
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
with:
17+
submodules: recursive
18+
19+
- name: Install Boost (only for Ubuntu)
20+
if: startsWith(matrix.os, 'ubuntu')
21+
run: sudo apt-get update && sudo apt-get install -yq libboost-dev
22+
23+
- name: Setup Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
28+
- name: Set architecture
29+
id: set_arch
30+
run: |
31+
# Check if the runner OS includes "arm" and set the ARCH environment variable accordingly
32+
if [[ "${{ matrix.os }}" == *arm* ]]; then
33+
echo "ARCH=arm64" >> $GITHUB_ENV
34+
else
35+
echo "ARCH=x64" >> $GITHUB_ENV
36+
fi
37+
echo "Architecture set to: $ARCH"
38+
39+
- name: Get latest release
40+
id: get_release
41+
uses: actions/github-script@v6
42+
with:
43+
script: |
44+
// Retrieve the latest release information using the GitHub API
45+
const release = await github.rest.repos.getLatestRelease({
46+
owner: context.repo.owner,
47+
repo: context.repo.repo
48+
});
49+
core.setOutput("upload_url", release.data.upload_url);
50+
core.setOutput("release_id", release.data.id);
51+
core.setOutput("tag", release.data.tag_name);
52+
console.log("Found release:", release.data.tag_name);
53+
54+
- name: Build project
55+
run: |
56+
# Install dependencies and run the build script
57+
npm install
58+
npm run build
59+
60+
- name: Package build
61+
run: |
62+
# Retrieve the release tag from the previous step
63+
TAG=${{ steps.get_release.outputs.tag }}
64+
# Set the build directory name using the release tag and architecture
65+
BUILD_DIR="deepnest-${TAG}-linux-${ARCH}"
66+
echo "Creating build in: $BUILD_DIR"
67+
# Run Electron Packager to package the application into the specified build directory
68+
npx @electron/packager . "$BUILD_DIR" --overwrite
69+
# Zip the build directory with the same name
70+
zip -r "${BUILD_DIR}.zip" "$BUILD_DIR"
71+
72+
- name: Artefakt an letztes Release anhängen
73+
uses: peter-evans/upload-release-asset@v1
74+
with:
75+
upload_url: ${{ steps.get_release.outputs.upload_url }}
76+
asset_path: deepnest-${{ steps.get_release.outputs.tag }}-linux-${{ env.ARCH }}.zip
77+
asset_name: deepnest-${{ steps.get_release.outputs.tag }}-linux-${{ env.ARCH }}.zip
78+
asset_content_type: application/zip

0 commit comments

Comments
 (0)