Update OBS Packages (v2) #795
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: Update OBS Packages (v2) | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| package: | |
| description: "Package to update" | |
| required: false | |
| type: choice | |
| options: | |
| - all | |
| - all-git | |
| - danksearch | |
| - dgop | |
| - ghostty | |
| - matugen | |
| - matugen-snapshot | |
| - niri | |
| - niri-git | |
| - quickshell | |
| - quickshell-git | |
| - xwayland-satellite | |
| - xwayland-satellite-git | |
| - dankcalendar-git | |
| default: "all" | |
| rebuild_number: | |
| description: "Rebuild number for .db suffix (e.g., 2, 3, 4)" | |
| required: false | |
| default: "" | |
| distro: | |
| description: "Target distro" | |
| required: false | |
| type: choice | |
| options: | |
| - both | |
| - debian | |
| - opensuse | |
| default: "both" | |
| schedule: | |
| - cron: "0 */6 * * *" # Every 6 hours for git packages | |
| jobs: | |
| build-and-upload: | |
| name: Build and upload packages | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Cache Ghostty Zig deps | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ github.workspace }}/.cache/ghostty-zig-deps | |
| key: ghostty-zig-deps-v1-${{ runner.os }} | |
| restore-keys: | | |
| ghostty-zig-deps-v1- | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y osc jq curl dpkg-dev debhelper libglib2.0-dev | |
| # Install yq | |
| sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 | |
| sudo chmod +x /usr/local/bin/yq | |
| # Configure osc | |
| mkdir -p ~/.config/osc | |
| cat > ~/.config/osc/oscrc << EOF | |
| [general] | |
| apiurl = https://api.opensuse.org | |
| [https://api.opensuse.org] | |
| user = ${{ secrets.OBS_USERNAME }} | |
| pass = ${{ secrets.OBS_PASSWORD }} | |
| EOF | |
| chmod 600 ~/.config/osc/oscrc | |
| - name: Test OBS authentication | |
| run: | | |
| echo "Testing OBS credentials..." | |
| if ! osc api /about > /dev/null 2>&1; then | |
| echo "❌ ERROR: OBS authentication failed!" | |
| echo "Please check that OBS_USERNAME and OBS_PASSWORD secrets are correctly set." | |
| exit 1 | |
| fi | |
| echo "✅ OBS authentication successful" | |
| - name: Install language-specific dependencies | |
| run: | | |
| # Install Rust | |
| curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | |
| source "$HOME/.cargo/env" | |
| # Install Go | |
| sudo snap install go --classic | |
| # Install CMake/Qt6 | |
| sudo apt-get install -y cmake qt6-base-dev | |
| - name: Determine packages to build | |
| id: packages | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| OBS_USERNAME: ${{ secrets.OBS_USERNAME }} | |
| OBS_PASSWORD: ${{ secrets.OBS_PASSWORD }} | |
| run: | | |
| # Determine which packages to build | |
| if [[ "${{ github.event_name }}" == "schedule" ]]; then | |
| PACKAGES="all" | |
| elif [[ -n "${{ github.event.inputs.package }}" ]]; then | |
| PACKAGES="${{ github.event.inputs.package }}" | |
| else | |
| PACKAGES="all" | |
| fi | |
| echo "Packages to process: $PACKAGES" | |
| echo "packages=$PACKAGES" >> $GITHUB_OUTPUT | |
| - name: Build and upload packages | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| OBS_USERNAME: ${{ secrets.OBS_USERNAME }} | |
| OBS_PASSWORD: ${{ secrets.OBS_PASSWORD }} | |
| PACKAGES: ${{ steps.packages.outputs.packages }} | |
| REBUILD_NUMBER: ${{ github.event.inputs.rebuild_number }} | |
| DISTRO: ${{ github.event.inputs.distro || 'both' }} | |
| GHOSTTY_VENDOR_CACHE_DIR: ${{ github.workspace }}/.cache/ghostty-zig-deps | |
| run: | | |
| # Build and upload with orchestrator | |
| if [[ -n "$REBUILD_NUMBER" ]]; then | |
| bash distro/scripts/obs/obs-orchestrator.sh \ | |
| --message="Automated update from GitHub Actions (rebuild $REBUILD_NUMBER)" \ | |
| "$PACKAGES" "$REBUILD_NUMBER" "$DISTRO" | |
| else | |
| bash distro/scripts/obs/obs-orchestrator.sh \ | |
| --message="Automated update from GitHub Actions" \ | |
| "$PACKAGES" "" "$DISTRO" | |
| fi | |
| - name: Upload build logs on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: build-logs | |
| path: | | |
| /tmp/obs-build-*/build.log | |
| /tmp/osc-*.log | |
| retention-days: 7 | |
| summary: | |
| name: Build summary | |
| needs: build-and-upload | |
| if: always() | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Generate summary | |
| run: | | |
| echo "# OBS Package Build Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Workflow:** \`${{ github.event_name }}\`" >> $GITHUB_STEP_SUMMARY | |
| echo "**Triggered by:** ${{ github.actor }}" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [[ "${{ needs.build-and-upload.result }}" == "success" ]]; then | |
| echo "**Status:** ✅ Build completed" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "**Status:** ❌ Build failed" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "---" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "📊 [View OBS Project](https://build.opensuse.org/project/show/home:AvengeMedia:danklinux)" >> $GITHUB_STEP_SUMMARY |