forked from suse-edge/Factory
Sync metadata, revamp PR jobs
Signed-off-by: Nicolas Belouin <nicolas.belouin@suse.com>
This commit is contained in:
40
.gitea/workflows/pr_project.yaml
Normal file
40
.gitea/workflows/pr_project.yaml
Normal file
@@ -0,0 +1,40 @@
|
||||
name: Synchronize Project Config
|
||||
on:
|
||||
pull_request_target:
|
||||
types:
|
||||
- opened
|
||||
- reopened
|
||||
- synchronize
|
||||
- closed
|
||||
branches-ignore:
|
||||
- "devel"
|
||||
|
||||
jobs:
|
||||
sync-prjconf:
|
||||
runs-on: tumbleweed
|
||||
steps:
|
||||
- run: |
|
||||
zypper in -y python3-jinja2
|
||||
mkdir -p ~/.config/osc
|
||||
cat >~/.config/osc/oscrc <<EOF
|
||||
[general]
|
||||
apiurl = https://api.opensuse.org
|
||||
|
||||
[https://api.opensuse.org]
|
||||
user=${{ vars.OBS_USERNAME }}
|
||||
pass=${{ secrets.OBS_PASSWORD }}
|
||||
EOF
|
||||
# Waiting on PR to get merged for support in upstream action/checkout action
|
||||
- uses: 'https://github.com/yangskyboxlabs/action-checkout@sha256'
|
||||
with:
|
||||
object-format: 'sha256'
|
||||
- if: gitea.event.action == "closed"
|
||||
run: |
|
||||
PROJECT="$(grep PROJECT .obs/common.py | sed 's/PROJECT = "\(.*\)"/\1/')"
|
||||
osc rdelete "${PROJECT}:Staging:PR-${{ gitea.event.number }}"
|
||||
- if: gitea.event.action != "closed"
|
||||
env:
|
||||
SCM_URL: ${{ gitea.event.pull_request.head.repo.clone_url }}#${{ gitea.head_ref }}
|
||||
run: |
|
||||
PROJECT="$(grep PROJECT .obs/common.py | sed 's/PROJECT = "\(.*\)"/\1/')"
|
||||
python3 .obs/render_meta.py --pr ${{ gitea.event.number }} --scm-url "${SCM_URL}" | osc meta prj "${PROJECT}:Staging:PR-${{ gitea.event.number }}" -F -
|
@@ -1,9 +1,8 @@
|
||||
name: Synchronize Project Config
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "main"
|
||||
- "3.*"
|
||||
branches-ignore:
|
||||
- "devel"
|
||||
paths:
|
||||
- "_config"
|
||||
- ".gitea/workflows/sync_config.yaml"
|
||||
@@ -28,6 +27,6 @@ jobs:
|
||||
object-format: 'sha256'
|
||||
- run: |
|
||||
PROJECT="$(grep PROJECT .obs/common.py | sed 's/PROJECT = "\(.*\)"/\1/')"
|
||||
if [ "$(osc meta prjconf "${PROJECT}" | sha256sum)" = "$(cat _config | sha256sum)" ] ; then
|
||||
if [ "$(osc meta prjconf "${PROJECT}" | sha256sum)" != "$(cat _config | sha256sum)" ] ; then
|
||||
osc meta prjconf "${PROJECT}" -F _config
|
||||
fi
|
||||
|
41
.gitea/workflows/sync_meta.yaml
Normal file
41
.gitea/workflows/sync_meta.yaml
Normal file
@@ -0,0 +1,41 @@
|
||||
name: Synchronize Project Metadata
|
||||
on:
|
||||
push:
|
||||
branches-ignore:
|
||||
- "devel"
|
||||
paths:
|
||||
- "_meta"
|
||||
- ".gitea/workflows/sync_meta.yaml"
|
||||
- ".obs/common.py"
|
||||
|
||||
jobs:
|
||||
sync-prjconf:
|
||||
runs-on: tumbleweed
|
||||
steps:
|
||||
- run: |
|
||||
zypper in -y python3-jinja2
|
||||
mkdir -p ~/.config/osc
|
||||
cat >~/.config/osc/oscrc <<EOF
|
||||
[general]
|
||||
apiurl = https://api.opensuse.org
|
||||
|
||||
[https://api.opensuse.org]
|
||||
user=${{ vars.OBS_USERNAME }}
|
||||
pass=${{ secrets.OBS_PASSWORD }}
|
||||
EOF
|
||||
# Waiting on PR to get merged for support in upstream action/checkout action
|
||||
- uses: 'https://github.com/yangskyboxlabs/action-checkout@sha256'
|
||||
with:
|
||||
object-format: 'sha256'
|
||||
- run: |
|
||||
PROJECT="$(grep PROJECT .obs/common.py | sed 's/PROJECT = "\(.*\)"/\1/')"
|
||||
set -o pipefail
|
||||
if meta="$(osc meta prj "${PROJECT}" 2>/dev/null | sha256sum)"; then
|
||||
new_meta="$(python3 .obs/render_meta.py)"
|
||||
if [ "${meta}" != "$(echo "${new_meta}" | sha256sum)"]; then
|
||||
echo "${new_meta}" | osc meta prj "${PROJECT}" -F -
|
||||
fi
|
||||
else
|
||||
# Create the projects
|
||||
bash .obs/create_projects.sh
|
||||
fi
|
Reference in New Issue
Block a user