-
Notifications
You must be signed in to change notification settings - Fork 2
178 lines (158 loc) · 5.63 KB
/
Copy pathrun-obs-v2.yml
File metadata and controls
178 lines (158 loc) · 5.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
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