Repository navigation
Release #8
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: | |
| inputs: | |
| version: | |
| description: "Release tag to build and publish, for example v0.1.5" | |
| required: true | |
| type: string | |
| permissions: | |
| contents: read | |
| jobs: | |
| tui-native: | |
| name: TUI native (${{ matrix.package }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| package: albert_tesla__mebius-code-linux-x64 | |
| executable: mebius | |
| expected_arch: x86_64 | |
| - os: macos-15-intel | |
| package: albert_tesla__mebius-code-darwin-x64 | |
| executable: mebius | |
| expected_arch: x86_64 | |
| - os: macos-15 | |
| package: albert_tesla__mebius-code-darwin-arm64 | |
| executable: mebius | |
| expected_arch: arm64 | |
| - os: windows-latest | |
| package: albert_tesla__mebius-code-win32-x64 | |
| executable: mebius.exe | |
| expected_arch: AMD64 | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| working-directory: tui | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event_name == 'workflow_dispatch' && inputs.version || github.ref_name }} | |
| - uses: oven-sh/setup-bun@v2 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| cache-dependency-path: tui/package-lock.json | |
| - name: Check runner architecture | |
| shell: bash | |
| run: | | |
| actual="$(uname -m)" | |
| if [[ "${{ runner.os }}" == "Windows" ]]; then actual="$PROCESSOR_ARCHITECTURE"; fi | |
| test "$actual" = "${{ matrix.expected_arch }}" | |
| - run: npm ci --ignore-scripts | |
| - run: npm run typecheck | |
| - run: bun test | |
| - name: Install Linux musl OpenTUI package for Bun compile | |
| if: matrix.package == 'albert_tesla__mebius-code-linux-x64' | |
| shell: bash | |
| run: | | |
| opentui_version="$(node -p "require('./node_modules/@opentui/core/package.json').version")" | |
| package_archive="$(npm pack --silent "@opentui/core-linux-x64-musl@$opentui_version")" | |
| mkdir -p node_modules/@opentui/core-linux-x64-musl | |
| tar -xzf "$package_archive" -C node_modules/@opentui/core-linux-x64-musl --strip-components=1 | |
| - name: Build native binary | |
| shell: bash | |
| run: | | |
| mkdir -p dist/native | |
| bun ./scripts/build-native.ts --outfile "dist/native/${{ matrix.executable }}" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.package }} | |
| path: tui/dist/native/** | |
| github-release: | |
| name: Publish GitHub Release assets | |
| runs-on: ubuntu-latest | |
| needs: | |
| - tui-native | |
| if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: tui/dist/native-artifacts | |
| - name: Package release assets | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| artifact_dir="$PWD/tui/dist/native-artifacts" | |
| release_dir="$PWD/tui/dist/release" | |
| rm -rf "$release_dir" | |
| mkdir -p "$release_dir" | |
| package_tar() { | |
| local package="$1" | |
| local asset="$2" | |
| local source_dir="$artifact_dir/$package" | |
| test -f "$source_dir/mebius" | |
| test -d "$source_dir/runtime" | |
| chmod +x "$source_dir/mebius" | |
| tar -C "$source_dir" -czf "$release_dir/$asset" mebius runtime | |
| } | |
| package_zip() { | |
| local package="$1" | |
| local asset="$2" | |
| local source_dir="$artifact_dir/$package" | |
| test -f "$source_dir/mebius.exe" | |
| test -d "$source_dir/runtime" | |
| (cd "$source_dir" && zip -qr "$release_dir/$asset" mebius.exe runtime) | |
| } | |
| package_tar "albert_tesla__mebius-code-linux-x64" "mebius-linux-x64.tar.gz" | |
| package_tar "albert_tesla__mebius-code-darwin-x64" "mebius-darwin-x64.tar.gz" | |
| package_tar "albert_tesla__mebius-code-darwin-arm64" "mebius-darwin-arm64.tar.gz" | |
| package_zip "albert_tesla__mebius-code-win32-x64" "mebius-windows-x64.zip" | |
| ( | |
| cd "$release_dir" | |
| sha256sum \ | |
| mebius-linux-x64.tar.gz \ | |
| mebius-darwin-x64.tar.gz \ | |
| mebius-darwin-arm64.tar.gz \ | |
| mebius-windows-x64.zip \ | |
| > SHA256SUMS | |
| ) | |
| ls -lh "$release_dir" | |
| - name: Prepare release metadata | |
| id: meta | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| tag="${{ inputs.version }}" | |
| else | |
| tag="${{ github.ref_name }}" | |
| fi | |
| test -n "$tag" | |
| cat > "$RUNNER_TEMP/tui-release-notes.md" <<EOF | |
| Native TUI binaries for $tag. | |
| Install with: | |
| Linux/macOS: | |
| \`\`\`bash | |
| curl -fsSL https://raw.githubusercontent.com/${{ github.repository }}/main/scripts/install-tui.sh | bash | |
| \`\`\` | |
| Windows PowerShell: | |
| \`\`\`powershell | |
| irm https://raw.githubusercontent.com/${{ github.repository }}/main/scripts/install-tui.ps1 | iex | |
| \`\`\` | |
| EOF | |
| echo "tag=$tag" >> "$GITHUB_OUTPUT" | |
| - name: Publish GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.meta.outputs.tag }} | |
| name: Mebius Code ${{ steps.meta.outputs.tag }} | |
| body_path: ${{ runner.temp }}/tui-release-notes.md | |
| overwrite_files: true | |
| files: | | |
| tui/dist/release/mebius-linux-x64.tar.gz | |
| tui/dist/release/mebius-darwin-x64.tar.gz | |
| tui/dist/release/mebius-darwin-arm64.tar.gz | |
| tui/dist/release/mebius-windows-x64.zip | |
| tui/dist/release/SHA256SUMS | |
| fail_on_unmatched_files: true | |
| npm: | |
| name: Publish npm packages | |
| runs-on: ubuntu-latest | |
| needs: | |
| - tui-native | |
| if: github.event_name == 'push' | |
| defaults: | |
| run: | |
| working-directory: tui | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event_name == 'workflow_dispatch' && inputs.version || github.ref_name }} | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| registry-url: https://registry.npmjs.org | |
| cache: npm | |
| cache-dependency-path: tui/package-lock.json | |
| - run: npm ci --ignore-scripts --omit=optional | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: tui/dist/native-artifacts | |
| - run: npm run stage:npm | |
| - name: Check npm token | |
| run: test -n "$NODE_AUTH_TOKEN" | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Publish platform packages | |
| run: | | |
| for package in \ | |
| albert_tesla__mebius-code-win32-x64 \ | |
| albert_tesla__mebius-code-linux-x64 \ | |
| albert_tesla__mebius-code-darwin-x64 \ | |
| albert_tesla__mebius-code-darwin-arm64 | |
| do | |
| npm publish "dist/npm/$package" --access public | |
| done | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Publish main package | |
| run: npm publish dist/npm/mebius-code --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |