Build Ubuntu #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ─── Build Deplao cho Ubuntu (Linux) ───────────────────────────────────────── | |
| # Chạy trên ubuntu-latest runner (GitHub Actions). | |
| # Sinh ra .AppImage + .deb cho x64. | |
| # | |
| # Trigger: push tag v* HOẶC chạy tay (workflow_dispatch) | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| name: Build Ubuntu | |
| permissions: | |
| contents: write | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| publish: | |
| description: 'Publish to GitHub Releases?' | |
| required: false | |
| default: 'false' | |
| type: choice | |
| options: | |
| - 'false' | |
| - 'true' | |
| tag_name: | |
| description: 'Tag cho release (vd: v26.4.0). Bỏ trống = tự lấy từ package.json' | |
| required: false | |
| default: '' | |
| type: string | |
| push: | |
| tags: | |
| - 'v*' | |
| # ─── SECRETS cần cấu hình ──────────────────────────────────────────────────── | |
| # GH_TOKEN — GitHub Personal Access Token (repo scope) | |
| jobs: | |
| build-ubuntu: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: 📥 Checkout code | |
| uses: actions/checkout@v4 | |
| - name: 🟢 Setup Node.js 22.x | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| - name: 🟢 Setup Go 1.x | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: 'stable' | |
| cache: false # don't cache Go modules — meta clone is side-effect | |
| - name: 📦 Install system dependencies | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install -y -qq \ | |
| libfuse2 \ | |
| dpkg-dev \ | |
| || echo 'WARN: some system deps may be missing' | |
| - name: 📦 Install npm dependencies | |
| run: npm ci --legacy-peer-deps | |
| - name: 🏗️ Build E2EE bridge (Go) | |
| run: npm run build:bridge-e2ee | |
| - name: 🏗️ Compile TypeScript (electron) | |
| run: npx tsc -p tsconfig.electron.prod.json | |
| - name: 🏗️ Build renderer (Vite) | |
| run: npx vite build | |
| env: | |
| NODE_ENV: production | |
| BUILD_TARGET: production | |
| - name: 🏷️ Xác định tag name | |
| id: get_tag | |
| if: startsWith(github.ref, 'refs/tags/v') || github.event.inputs.publish == 'true' | |
| shell: bash | |
| run: | | |
| if [ -n "${{ github.event.inputs.tag_name }}" ]; then | |
| echo "tag=${{ github.event.inputs.tag_name }}" >> $GITHUB_OUTPUT | |
| elif [[ "$GITHUB_REF" == refs/tags/* ]]; then | |
| echo "tag=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT | |
| else | |
| VERSION=$(node -p "require('./package.json').version") | |
| echo "tag=v${VERSION}" >> $GITHUB_OUTPUT | |
| fi | |
| echo "✅ Tag: $(grep '^tag=' $GITHUB_OUTPUT | cut -d= -f2)" | |
| - name: 📦 Build Linux app (x64 — AppImage + deb) | |
| run: npx electron-builder --linux --x64 --publish never | |
| - name: 🚀 Publish lên GitHub Releases | |
| if: startsWith(github.ref, 'refs/tags/v') || github.event.inputs.publish == 'true' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| repository: babyvibe/deplao-builder | |
| tag_name: ${{ steps.get_tag.outputs.tag }} | |
| name: "Deplao ${{ steps.get_tag.outputs.tag }}" | |
| files: | | |
| dist-electron-build/*.AppImage | |
| dist-electron-build/*.deb | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| draft: false | |
| prerelease: false | |
| make_latest: false | |
| fail_on_unmatched_files: false | |
| # ─── File sau khi publish ────────────────────────────────────────────── | |
| # Xem release tại: https://github.com/babyvibe/deplao-builder/releases | |
| # Link tải cố định: | |
| # https://github.com/babyvibe/deplao-builder/releases/latest/download/Deplao-{version}.AppImage | |
| # https://github.com/babyvibe/deplao-builder/releases/latest/download/Deplao_{version}_amd64.deb |