This repository was archived by the owner on Dec 1, 2025. It is now read-only.
Build Ruby RPM (Simple) #26
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: Build Ruby RPM (Simple) | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| arch: | |
| description: 'Target architecture' | |
| required: true | |
| default: 'x86_64' | |
| type: choice | |
| options: | |
| - x86_64 | |
| - aarch64 | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Build Docker image | |
| run: | | |
| if [ "${{ github.event.inputs.arch }}" = "x86_64" ]; then | |
| PLATFORM="linux/amd64" | |
| else | |
| PLATFORM="linux/arm64" | |
| fi | |
| echo "Building for platform: $PLATFORM" | |
| docker buildx build \ | |
| --platform $PLATFORM \ | |
| --load \ | |
| -t ruby-builder \ | |
| . | |
| - name: Extract RPMs | |
| run: | | |
| mkdir -p output | |
| # Get current user ID to fix permissions | |
| USER_ID=$(id -u) | |
| GROUP_ID=$(id -g) | |
| # Run container and extract files with proper permissions | |
| docker run --rm \ | |
| --user root \ | |
| -v $(pwd)/output:/output \ | |
| ruby-builder bash -c " | |
| echo 'Container contents:' | |
| ls -la /home/builder/ | |
| echo '' | |
| echo 'RPM build output:' | |
| ls -la /home/builder/output/ 2>/dev/null || echo 'No output directory found' | |
| echo '' | |
| # Copy all RPMs from output directory | |
| if [ -d '/home/builder/output' ] && [ \$(find /home/builder/output -name '*.rpm' | wc -l) -gt 0 ]; then | |
| echo 'Copying RPMs from output directory...' | |
| cp /home/builder/output/*.rpm /output/ 2>/dev/null || true | |
| echo 'Copied RPMs from output directory' | |
| fi | |
| # Also copy from traditional RPM build locations as backup | |
| if [ -d '/home/builder/rpmbuild/RPMS' ]; then | |
| echo 'Copying from rpmbuild RPMS...' | |
| find /home/builder/rpmbuild/RPMS -name '*.rpm' -exec cp {} /output/ \; 2>/dev/null || true | |
| fi | |
| if [ -d '/home/builder/rpmbuild/SRPMS' ]; then | |
| echo 'Copying source RPMs...' | |
| find /home/builder/rpmbuild/SRPMS -name '*.rpm' -exec cp {} /output/ \; 2>/dev/null || true | |
| fi | |
| # Copy spec files if they exist | |
| if [ -f '/home/builder/rpmbuild/SPECS/ruby.spec' ]; then | |
| cp /home/builder/rpmbuild/SPECS/ruby.spec /output/ruby-modified.spec 2>/dev/null || true | |
| echo 'Copied modified spec' | |
| fi | |
| if [ -f '/home/builder/rpmbuild/SPECS/ruby.spec.bak' ]; then | |
| cp /home/builder/rpmbuild/SPECS/ruby.spec.bak /output/ruby-original.spec 2>/dev/null || true | |
| echo 'Copied original spec' | |
| fi | |
| # Fix ownership of copied files | |
| chown -R $USER_ID:$GROUP_ID /output/ 2>/dev/null || true | |
| echo '' | |
| echo 'Final output contents:' | |
| ls -la /output/ | |
| " | |
| - name: List output | |
| run: | | |
| echo "Generated files:" | |
| ls -la output/ | |
| if [ $(find output -name '*.rpm' | wc -l) -gt 0 ]; then | |
| echo "" | |
| echo "RPM details:" | |
| for rpm in output/*.rpm; do | |
| if [ -f "$rpm" ]; then | |
| echo "=== $(basename $rpm) ===" | |
| rpm -qp --info "$rpm" 2>/dev/null || echo "Could not read RPM info for $rpm" | |
| echo "" | |
| fi | |
| done | |
| else | |
| echo "No RPM files found in output directory" | |
| fi | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ruby-3.0.7-${{ github.event.inputs.arch }}-rpms | |
| path: output/ | |
| retention-days: 7 | |
| if: always() |