This commit is contained in:
2025-05-28 00:25:05 +08:00
parent bf527ec9d3
commit 341e2bd887
8 changed files with 104 additions and 0 deletions

View File

@ -0,0 +1,53 @@
name: Trigger OBS build
on:
pull_request:
types: [opened, synchronize]
push:
branches:
- develop
push:
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install osc
run: sudo apt-get update && sudo apt-get install -y osc
- name: Configure osc
env:
OBS_USER: ${{ secrets.OBS_USER }}
OBS_PASS: ${{ secrets.OBS_PASS }}
run: |
mkdir -p ~/.config/osc
cat >~/.config/osc/oscrc <<EOF
[general]
apiurl = https://obs.example.com
[https://obs.example.com]
user = $OBS_USER
pass = $OBS_PASS
EOF
- name: Decide target project
id: prep
run: |
if [[ "${{ gitea.event_name }}" == "pull_request" ]]; then
echo "project=CI:${{ gitea.repository }}:PR-${{ gitea.pr_number }}" >>$GITHUB_OUTPUT
elif [[ "${{ gitea.ref_type }}" == "tag" ]]; then
tag=${{ gitea.ref_name }}
echo "project=Unstable:${{ gitea.repository }}:$tag" >>$GITHUB_OUTPUT
else
echo "project=CI:${{ gitea.repository }}-develop" >>$GITHUB_OUTPUT
fi
- name: Branch & submit
run: |
proj='${{ steps.prep.outputs.project }}'
osc api "/source/$proj?cmd=branch" || true
osc up
osc ci -m "Auto build via Gitea Actions"

21
.obs/workflows.yml Normal file
View File

@ -0,0 +1,21 @@
name: obs
workflows:
test_build:
trigger: pull_request
project: "CI:${{ repo }}:PR-${{ pr.number }}"
repositories:
- local_develop
commit_build:
trigger: push
branch: develop
project: "CI:${{ repo }}-develop"
repositories:
- local_develop
tag_build:
trigger: tag
project: "Unstable:${{ repo }}:${{ tag }}"
repositories:
- local_unstable

View File

@ -0,0 +1,3 @@
# demo-hello
最小可跑通的 Gitea + OBS CI 示例仓库。

5
debian/changelog vendored Normal file
View File

@ -0,0 +1,5 @@
hello (0.1-1) unstable; urgency=medium
* Initial release
-- Demo Maintainer <demo@example.com> Tue, 27 May 2025 16:19:19

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
13

13
debian/control vendored Normal file
View File

@ -0,0 +1,13 @@
Source: hello
Section: misc
Priority: optional
Maintainer: Demo Maintainer <demo@example.com>
Build-Depends: debhelper-compat (= 13)
Standards-Version: 4.6.2
Homepage: https://example.com/hello
Package: hello
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Hello World demo program
A minimal program that prints “Hello, world!” on the command line.

3
debian/rules vendored Normal file
View File

@ -0,0 +1,3 @@
#!/usr/bin/make -f
%:
dh $@

5
src/hello.c Normal file
View File

@ -0,0 +1,5 @@
#include <stdio.h>
int main(void) {
puts("Hello, world!");
return 0;
}