Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 92 additions & 4 deletions .github/workflows/update-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ jobs:
safe_version = re.sub(r"[^A-Za-z0-9._-]+", "-", version).strip("-")

output_line("version", version)
output_line("current_version", current_version)
output_line("safe_version", safe_version)
output_line("distribution", distribution)
output_line("base_branch", base_branch)
Expand Down Expand Up @@ -266,16 +267,104 @@ jobs:
for title in titles[1:]:
subprocess.run(["dch", "-a", title], check=True)

- name: Sync linglong.yaml version
id: sync_linglong
shell: python
env:
VERSION: ${{ steps.prepare.outputs.version }}
CURRENT_VERSION: ${{ steps.prepare.outputs.current_version }}
run: |
import os
import pathlib
import re

version = os.environ["VERSION"].strip()
current_version = os.environ["CURRENT_VERSION"].strip()
repo_root = pathlib.Path(os.environ["GITHUB_WORKSPACE"])

def write_output(files):
if len(files) == 1:
with open(os.environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as fh:
fh.write(f"files={files[0]}\n")
else:
delimiter = "CHANGELOGFILES"
with open(os.environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as fh:
fh.write(f"files<<{delimiter}\n")
for item in files:
fh.write(item + "\n")
fh.write(delimiter + "\n")

def strip_epoch(value):
if ":" in value:
_, value = value.split(":", 1)
return value

current_base = strip_epoch(current_version)

targets = sorted(repo_root.glob("linglong*.yaml"))
if not targets:
print("no linglong*.yaml found, skip")
write_output(["debian/changelog"])
raise SystemExit(0)

changed = []
for path in targets:
lines = path.read_text(encoding="utf-8").splitlines()
package_start = next(
(i for i, line in enumerate(lines) if re.match(r"^package:\s*$", line)),
None,
)
if package_start is None:
print(f"skip {path}: no package block")
continue

updated = False
for i, line in enumerate(lines):
if i <= package_start:
continue
if re.match(r"^\S", line):
break
m = re.match(r"^(\s*version:\s*)(\S+)\s*$", line)
if not m:
continue
old = m.group(2).strip()
old_base = strip_epoch(old)
parts = old_base.split(".")
new_val = old
if (
len(parts) > 1
and parts[-1].isdigit()
and ".".join(parts[:-1]) == current_base
):
new_val = f"{version}.{parts[-1]}"
elif old_base == current_base:
new_val = version
if new_val != old:
lines[i] = m.group(1) + new_val
updated = True
print(f"bump {path} version: {old} -> {new_val}")

if updated:
path.write_text("\n".join(lines) + "\n", encoding="utf-8")
changed.append(path.name)

if changed:
write_output(["debian/changelog"] + changed)
else:
write_output(["debian/changelog"])

- name: Show changelog diff
if: ${{ !inputs.create_pr }}
run: git diff -- debian/changelog
run: git diff -- debian/changelog linglong*.yaml

- name: Upload generated changelog
if: ${{ !inputs.create_pr }}
uses: actions/upload-artifact@v4
with:
name: generated-changelog
path: debian/changelog
path: |
debian/changelog
linglong*.yaml

- name: Create pull request
id: create_pr
Expand All @@ -298,8 +387,7 @@ jobs:
- Base branch: `${{ steps.prepare.outputs.base_branch }}`
- Base changelog commit: `${{ steps.prepare.outputs.base_sha }}`
- Head commit: `${{ steps.prepare.outputs.head_sha }}`
add-paths: |
debian/changelog
add-paths: ${{ steps.sync_linglong.outputs.files }}
delete-branch: true

- name: Show pull request result
Expand Down
10 changes: 9 additions & 1 deletion repos/linuxdeepin/dde-calendar.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,13 @@
".github/workflows/call-tag-build.yml"
],
"dest": "linuxdeepin/dde-calendar/.github/workflows/call-tag-build.yml"
},
{
"branch": [
"master",
"release/snipe"
],
"src": "workflow-templates/call-update-changelog.yml",
"dest": "linuxdeepin/dde-calendar/.github/workflows/call-update-changelog.yml"
}
]
]
9 changes: 8 additions & 1 deletion repos/linuxdeepin/dde-cooperation.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,12 @@
".github/workflows/call-tag-build.yml"
],
"dest": "linuxdeepin/dde-cooperation/.github/workflows/call-tag-build.yml"
},
{
"branch": [
"master"
],
"src": "workflow-templates/call-update-changelog.yml",
"dest": "linuxdeepin/dde-cooperation/.github/workflows/call-update-changelog.yml"
}
]
]
9 changes: 8 additions & 1 deletion repos/linuxdeepin/dde-device-formatter.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,12 @@
".github/workflows/call-tag-build.yml"
],
"dest": "linuxdeepin/dde-device-formatter/.github/workflows/call-tag-build.yml"
},
{
"branch": [
"master"
],
"src": "workflow-templates/call-update-changelog.yml",
"dest": "linuxdeepin/dde-device-formatter/.github/workflows/call-update-changelog.yml"
}
]
]
10 changes: 9 additions & 1 deletion repos/linuxdeepin/dde-file-manager.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,13 @@
],
"src": "workflow-templates/call-static-check.yml",
"dest": "linuxdeepin/dde-file-manager/.github/workflows/call-static-check.yml"
},
{
"branch": [
"master",
"release/snipe"
],
"src": "workflow-templates/call-update-changelog.yml",
"dest": "linuxdeepin/dde-file-manager/.github/workflows/call-update-changelog.yml"
}
]
]
12 changes: 11 additions & 1 deletion repos/linuxdeepin/dde-grand-search.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,15 @@
".github/workflows/call-tag-build.yml"
],
"dest": "linuxdeepin/dde-grand-search/.github/workflows/call-tag-build.yml"
},
{
"branch": [
"master",
"develop/snipe",
"release/snipe",
"release/eagle"
],
"src": "workflow-templates/call-update-changelog.yml",
"dest": "linuxdeepin/dde-grand-search/.github/workflows/call-update-changelog.yml"
}
]
]
10 changes: 9 additions & 1 deletion repos/linuxdeepin/deepin-album.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,13 @@
".github/workflows/call-tag-build.yml"
],
"dest": "linuxdeepin/deepin-album/.github/workflows/call-tag-build.yml"
},
{
"branch": [
"master",
"release/eagle"
],
"src": "workflow-templates/call-update-changelog.yml",
"dest": "linuxdeepin/deepin-album/.github/workflows/call-update-changelog.yml"
}
]
]
11 changes: 10 additions & 1 deletion repos/linuxdeepin/deepin-anything.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,14 @@
".github/workflows/call-tag-build.yml"
],
"dest": "linuxdeepin/deepin-anything/.github/workflows/call-tag-build.yml"
},
{
"branch": [
"master",
"develop/snipe",
"release/snipe"
],
"src": "workflow-templates/call-update-changelog.yml",
"dest": "linuxdeepin/deepin-anything/.github/workflows/call-update-changelog.yml"
}
]
]
10 changes: 9 additions & 1 deletion repos/linuxdeepin/deepin-boot-maker.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,13 @@
".github/workflows/call-tag-build.yml"
],
"dest": "linuxdeepin/deepin-boot-maker/.github/workflows/call-tag-build.yml"
},
{
"branch": [
"master",
"release/eagle"
],
"src": "workflow-templates/call-update-changelog.yml",
"dest": "linuxdeepin/deepin-boot-maker/.github/workflows/call-update-changelog.yml"
}
]
]
10 changes: 9 additions & 1 deletion repos/linuxdeepin/deepin-calculator.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,13 @@
".github/workflows/call-tag-build.yml"
],
"dest": "linuxdeepin/deepin-calculator/.github/workflows/call-tag-build.yml"
},
{
"branch": [
"master",
"release/eagle"
],
"src": "workflow-templates/call-update-changelog.yml",
"dest": "linuxdeepin/deepin-calculator/.github/workflows/call-update-changelog.yml"
}
]
]
10 changes: 9 additions & 1 deletion repos/linuxdeepin/deepin-camera.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,13 @@
".github/workflows/call-tag-build.yml"
],
"dest": "linuxdeepin/deepin-camera/.github/workflows/call-tag-build.yml"
},
{
"branch": [
"master",
"release/eagle"
],
"src": "workflow-templates/call-update-changelog.yml",
"dest": "linuxdeepin/deepin-camera/.github/workflows/call-update-changelog.yml"
}
]
]
10 changes: 9 additions & 1 deletion repos/linuxdeepin/deepin-compressor.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,13 @@
".github/workflows/call-tag-build.yml"
],
"dest": "linuxdeepin/deepin-compressor/.github/workflows/call-tag-build.yml"
},
{
"branch": [
"master",
"release/eagle"
],
"src": "workflow-templates/call-update-changelog.yml",
"dest": "linuxdeepin/deepin-compressor/.github/workflows/call-update-changelog.yml"
}
]
]
10 changes: 9 additions & 1 deletion repos/linuxdeepin/deepin-deb-installer.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,13 @@
".github/workflows/call-tag-build.yml"
],
"dest": "linuxdeepin/deepin-deb-installer/.github/workflows/call-tag-build.yml"
},
{
"branch": [
"master",
"release/eagle"
],
"src": "workflow-templates/call-update-changelog.yml",
"dest": "linuxdeepin/deepin-deb-installer/.github/workflows/call-update-changelog.yml"
}
]
]
10 changes: 9 additions & 1 deletion repos/linuxdeepin/deepin-devicemanager.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,13 @@
".github/workflows/call-tag-build.yml"
],
"dest": "linuxdeepin/deepin-devicemanager/.github/workflows/call-tag-build.yml"
},
{
"branch": [
"master",
"release/eagle"
],
"src": "workflow-templates/call-update-changelog.yml",
"dest": "linuxdeepin/deepin-devicemanager/.github/workflows/call-update-changelog.yml"
}
]
]
10 changes: 9 additions & 1 deletion repos/linuxdeepin/deepin-diskmanager.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,13 @@
".github/workflows/call-tag-build.yml"
],
"dest": "linuxdeepin/deepin-diskmanager/.github/workflows/call-tag-build.yml"
},
{
"branch": [
"master",
"develop/snipe"
],
"src": "workflow-templates/call-update-changelog.yml",
"dest": "linuxdeepin/deepin-diskmanager/.github/workflows/call-update-changelog.yml"
}
]
]
10 changes: 9 additions & 1 deletion repos/linuxdeepin/deepin-downloader.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,13 @@
".github/workflows/call-tag-build.yml"
],
"dest": "linuxdeepin/deepin-downloader/.github/workflows/call-tag-build.yml"
},
{
"branch": [
"master",
"release/eagle"
],
"src": "workflow-templates/call-update-changelog.yml",
"dest": "linuxdeepin/deepin-downloader/.github/workflows/call-update-changelog.yml"
}
]
]
10 changes: 9 additions & 1 deletion repos/linuxdeepin/deepin-draw.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,13 @@
".github/workflows/call-tag-build.yml"
],
"dest": "linuxdeepin/deepin-draw/.github/workflows/call-tag-build.yml"
},
{
"branch": [
"master",
"release/eagle"
],
"src": "workflow-templates/call-update-changelog.yml",
"dest": "linuxdeepin/deepin-draw/.github/workflows/call-update-changelog.yml"
}
]
]
12 changes: 11 additions & 1 deletion repos/linuxdeepin/deepin-editor.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,15 @@
".github/workflows/call-tag-build.yml"
],
"dest": "linuxdeepin/deepin-editor/.github/workflows/call-tag-build.yml"
},
{
"branch": [
"master",
"develop/snipe",
"release/snipe",
"release/eagle"
],
"src": "workflow-templates/call-update-changelog.yml",
"dest": "linuxdeepin/deepin-editor/.github/workflows/call-update-changelog.yml"
}
]
]
Loading
Loading