test #43
Workflow file for this run
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
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write # Grant write access to repository contents | |
| jobs: | |
| build-docker-images: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - arch: amd64 | |
| runner: ubuntu-22.04 | |
| - arch: arm64 | |
| runner: ubuntu-22.04-arm | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Clean up disk space | |
| run: | | |
| df -h | |
| docker image prune -f | |
| docker container prune -f | |
| docker volume prune -f | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
| df -h | |
| - name: Build sandbox Docker image for ${{ matrix.arch }} | |
| run: | | |
| cd sandbox | |
| docker buildx build \ | |
| --platform linux/${{ matrix.arch }} \ | |
| --tag e2b-sandbox:latest \ | |
| --load \ | |
| . | |
| - name: Save Docker image to tar.gz | |
| run: | | |
| docker save e2b-sandbox:latest | gzip -1 > e2b-sandbox-${{ matrix.arch }}.tar.gz | |
| ls -lh e2b-sandbox-${{ matrix.arch }}.tar.gz | |
| - name: Cache Docker image | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: e2b-sandbox-${{ matrix.arch }}.tar.gz | |
| key: docker-image-${{ matrix.arch }}-${{ github.run_id }} | |
| enableCrossOsArchive: true | |
| release: | |
| needs: build-docker-images | |
| continue-on-error: true | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # macOS (Intel & Apple Silicon) | |
| - runner: macos-13 | |
| artifact_name: EdgeBox-macos-x64 | |
| artifact_path: | | |
| out/make/**/*.dmg | |
| out/make/**/*.zip | |
| arch: amd64 | |
| - runner: macos-14 | |
| artifact_name: EdgeBox-macos-arm64 | |
| artifact_path: | | |
| out/make/**/*.dmg | |
| out/make/**/*.zip | |
| arch: arm64 | |
| # Windows (x64 & ARM64) | |
| - runner: windows-latest | |
| artifact_name: EdgeBox-windows-x64 | |
| artifact_path: | | |
| out/make/**/*.zip | |
| arch: amd64 | |
| shell: bash | |
| # - runner: windows-11-arm | |
| # artifact_name: EdgeBox-windows-arm64 | |
| # artifact_path: | | |
| # out/make/**/*.exe | |
| # out/make/**/*.msi | |
| # arch: arm64 | |
| # Linux (x64 & ARM64) | |
| - runner: ubuntu-22.04 | |
| artifact_name: EdgeBox-linux-x64 | |
| artifact_path: | | |
| out/make/**/*.AppImage | |
| out/make/**/*.deb | |
| out/make/**/*.rpm | |
| arch: amd64 | |
| - runner: ubuntu-22.04-arm | |
| artifact_name: EdgeBox-linux-arm64 | |
| artifact_path: | | |
| out/make/**/*.AppImage | |
| out/make/**/*.deb | |
| out/make/**/*.rpm | |
| arch: arm64 | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - name: Clean up disk space | |
| if: runner.os == 'Linux' | |
| run: | | |
| df -h | |
| docker image prune -f | |
| docker container prune -f | |
| docker volume prune -f | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
| df -h | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: latest | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Restore Docker image from cache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: e2b-sandbox-${{ matrix.arch }}.tar.gz | |
| key: docker-image-${{ matrix.arch }}-${{ github.run_id }} | |
| enableCrossOsArchive: true | |
| - name: Create sandbox_images directory and rename Docker image | |
| shell: bash | |
| run: | | |
| mkdir -p sandbox_images | |
| mv e2b-sandbox-${{ matrix.arch }}.tar.gz sandbox_images/e2b-sandbox-latest.tar.gz | |
| - name: Make application | |
| run: pnpm run make | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact_name }} | |
| path: ${{ matrix.artifact_path }} | |
| create-release: | |
| needs: release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download application artifacts only | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: EdgeBox-* | |
| path: artifacts | |
| - name: Create Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| release_name: Release ${{ github.ref_name }} | |
| draft: false | |
| prerelease: false | |
| - name: Prepare release assets with zip split | |
| run: | | |
| # Create release_assets directory | |
| mkdir -p release_assets | |
| # Clean up any existing split files first | |
| rm -f release_assets/*.7z.* release_assets/*.zip.* release_assets/*.z* | |
| echo "=== Processing artifacts ===" | |
| find artifacts -type f | while read artifact; do | |
| asset_name=$(basename "$artifact") | |
| # base_name="${asset_name%.*}" | |
| base_name=asset_name | |
| echo "Processing: $asset_name" | |
| # Check file size in GB | |
| file_size_gb=$(($(stat -c%s "$artifact") / 1024 / 1024 / 1024)) | |
| if [ $file_size_gb -ge 1 ]; then | |
| echo "File larger than 1GB, splitting into volumes..." | |
| # Split into 1.5GB parts | |
| zip -s 1500m -0 "release_assets/${base_name}.zip" "$artifact" && rm -f "$artifact" | |
| else | |
| echo "File is under 2GB, moving to release_assets" | |
| # Ensure no leftover old files | |
| rm -f "release_assets/$asset_name" | |
| mv "$artifact" "release_assets/$asset_name" | |
| fi | |
| done | |
| - name: Upload Release Assets | |
| run: | | |
| find release_assets -type f | while read asset; do | |
| echo "Uploading $(basename "$asset")" | |
| gh release upload "${{ github.ref_name }}" "$asset" --clobber --repo "${{ github.repository }}" | |
| done | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |