Skip to content

Update Needle with unified installation system and needlectl integration #9

Update Needle with unified installation system and needlectl integration

Update Needle with unified installation system and needlectl integration #9

Workflow file for this run

name: Build UI and Publish Artifacts
on:
push:
paths:
- 'ui/**'
- '.github/workflows/build-ui.yml'
pull_request:
paths:
- 'ui/**'
- '.github/workflows/build-ui.yml'
workflow_dispatch:
jobs:
build-ui:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: ui/package-lock.json
- name: Install UI dependencies
working-directory: ./ui
run: npm ci
- name: Build UI
working-directory: ./ui
run: npm run build
- name: Create UI build artifacts
run: |
cd ui
tar -czf ../ui-build-linux.tar.gz build/
- name: Upload UI artifacts
uses: actions/upload-artifact@v4
with:
name: ui-build-linux
path: ui-build-linux.tar.gz
retention-days: 30
build-ui-macos:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: ui/package-lock.json
- name: Install UI dependencies
working-directory: ./ui
run: npm ci
- name: Build UI
working-directory: ./ui
run: npm run build
- name: Create UI build artifacts
run: |
cd ui
tar -czf ../ui-build-macos.tar.gz build/
- name: Upload UI artifacts
uses: actions/upload-artifact@v4
with:
name: ui-build-macos
path: ui-build-macos.tar.gz
retention-days: 30
publish-release:
needs: [build-ui, build-ui-macos]
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download UI artifacts
uses: actions/download-artifact@v4
with:
name: ui-build-linux
path: ./artifacts/linux/
- name: Download UI artifacts (macOS)
uses: actions/download-artifact@v4
with:
name: ui-build-macos
path: ./artifacts/macos/
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ui-build-${{ github.run_number }}
release_name: UI Build ${{ github.run_number }}
body: |
Pre-built UI artifacts for Needle installation.
This release contains:
- `ui-build-linux.tar.gz` - Linux UI build artifacts
- `ui-build-macos.tar.gz` - macOS UI build artifacts
These artifacts are automatically downloaded during installation to speed up the process.
draft: false
prerelease: false
- name: Upload Linux UI Artifacts
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/linux/ui-build-linux.tar.gz
asset_name: ui-build-linux.tar.gz
asset_content_type: application/gzip
- name: Upload macOS UI Artifacts
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/macos/ui-build-macos.tar.gz
asset_name: ui-build-macos.tar.gz
asset_content_type: application/gzip
update-latest-release:
needs: [publish-release]
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download UI artifacts
uses: actions/download-artifact@v4
with:
name: ui-build-linux
path: ./artifacts/linux/
- name: Download UI artifacts (macOS)
uses: actions/download-artifact@v4
with:
name: ui-build-macos
path: ./artifacts/macos/
- name: Get latest release
id: get_latest_release
uses: actions/github-script@v7
with:
script: |
const { data: releases } = await github.rest.repos.listReleases({
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 1
});
if (releases.length === 0) {
throw new Error('No releases found');
}
return releases[0];
- name: Update latest release with UI artifacts
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.get_latest_release.outputs.result.tag_name }}
files: |
./artifacts/linux/ui-build-linux.tar.gz
./artifacts/macos/ui-build-macos.tar.gz
overwrite: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}