Skip to content

Commit 1c695ce

Browse files
committed
build windows also from github
1 parent 50f1d53 commit 1c695ce

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

.github/workflows/build_release.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,77 @@ jobs:
151151
# Zip the build directory with the same name
152152
zip -r "${BUILD_DIR}.zip" "$BUILD_DIR"
153153
154+
- name: Artefakt an letztes Release anhängen
155+
uses: actions/upload-release-asset@v1
156+
env:
157+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
158+
with:
159+
upload_url: ${{ steps.get_release.outputs.upload_url }}
160+
asset_path: deepnest-${{ steps.get_release.outputs.tag }}-${{ env.BUILD_FOR_OS}}-${{ env.ARCH }}.zip
161+
asset_name: deepnest-${{ steps.get_release.outputs.tag }}-${{ env.BUILD_FOR_OS}}-${{ env.ARCH }}.zip
162+
asset_content_type: application/zip
163+
164+
build-and-release-windows:
165+
env:
166+
BUILD_FOR_OS: win32
167+
strategy:
168+
matrix:
169+
node-version: [22.x]
170+
os: [windows-latest]
171+
runs-on: ${{ matrix.os }}
172+
steps:
173+
- name: Checkout repository
174+
uses: actions/checkout@v4
175+
with:
176+
submodules: recursive
177+
178+
- name: Setup Node.js ${{ matrix.node-version }}
179+
uses: actions/setup-node@v4
180+
with:
181+
node-version: ${{ matrix.node-version }}
182+
183+
- name: Set architecture
184+
id: set_arch
185+
run: |
186+
echo "ARCH=x64" >> $env:GITHUB_ENV
187+
echo "Architecture set to: x64"
188+
shell: pwsh
189+
190+
- name: Get latest release
191+
id: get_release
192+
uses: actions/github-script@v6
193+
with:
194+
script: |
195+
// Retrieve the latest release information using the GitHub API
196+
const release = await github.rest.repos.getLatestRelease({
197+
owner: context.repo.owner,
198+
repo: context.repo.repo
199+
});
200+
core.setOutput("upload_url", release.data.upload_url);
201+
core.setOutput("release_id", release.data.id);
202+
core.setOutput("tag", release.data.tag_name);
203+
console.log("Found release:", release.data.tag_name);
204+
205+
- name: Build project
206+
run: |
207+
# Install dependencies and run the build script
208+
npm install
209+
npm run build
210+
shell: bash
211+
212+
- name: Package build
213+
run: |
214+
# Retrieve the release tag from the previous step
215+
TAG=${{ steps.get_release.outputs.tag }}
216+
# Set the build directory name using the release tag and architecture
217+
BUILD_DIR="deepnest-${TAG}-${BUILD_FOR_OS}-${ARCH}"
218+
echo "Creating build in: $BUILD_DIR"
219+
# Run Electron Packager to package the application into the specified build directory
220+
npx @electron/packager . "deepnest-${TAG}" --overwrite
221+
# Zip the build directory with the same name
222+
7z a "${BUILD_DIR}.zip" "$BUILD_DIR"
223+
shell: bash
224+
154225
- name: Artefakt an letztes Release anhängen
155226
uses: actions/upload-release-asset@v1
156227
env:

0 commit comments

Comments
 (0)