Skip to content

Commit d41098e

Browse files
committed
chore: release 0.1.8
1 parent 1f8757a commit d41098e

4 files changed

Lines changed: 67 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,3 +223,54 @@ jobs:
223223
body_path: release-notes.md
224224
overwrite_files: true
225225
files: release-assets/checksums.txt
226+
227+
notify:
228+
needs: [prepare, release]
229+
if: ${{ always() && needs.prepare.result == 'success' && needs.release.result == 'success' }}
230+
runs-on: ubuntu-latest
231+
steps:
232+
- name: Notify WeCom release
233+
env:
234+
WECHAT_WEBHOOK_URL: ${{ secrets.WECHAT_WEBHOOK_URL }}
235+
TAG: ${{ needs.prepare.outputs.tag }}
236+
VERSION: ${{ needs.prepare.outputs.version }}
237+
REPOSITORY: ${{ github.repository }}
238+
RELEASE_URL: https://github.com/${{ github.repository }}/releases/tag/${{ needs.prepare.outputs.tag }}
239+
run: |
240+
set -euo pipefail
241+
242+
if [ -z "${WECHAT_WEBHOOK_URL}" ]; then
243+
echo "WECHAT_WEBHOOK_URL secret is required for release notifications" >&2
244+
exit 1
245+
fi
246+
247+
python - <<'PY' > wecom-payload.json
248+
import json
249+
import os
250+
251+
content = "\n".join(
252+
[
253+
f"{os.environ['REPOSITORY']} {os.environ['TAG']} published.",
254+
f"Version: {os.environ['VERSION']}",
255+
f"Release: {os.environ['RELEASE_URL']}",
256+
]
257+
)
258+
print(
259+
json.dumps(
260+
{
261+
"msgtype": "text",
262+
"text": {
263+
"content": content,
264+
"mentioned_list": ["@all"],
265+
},
266+
},
267+
ensure_ascii=False,
268+
)
269+
)
270+
PY
271+
272+
curl -fsS \
273+
-X POST \
274+
-H 'Content-Type: application/json' \
275+
--data @wecom-payload.json \
276+
"${WECHAT_WEBHOOK_URL}"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "atlassian-cli"
7-
version = "0.1.7"
7+
version = "0.1.8"
88
description = "CLI for Atlassian Server and Data Center products"
99
readme = "README.md"
1010
requires-python = ">=3.12"

src/atlassian_cli/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
__all__ = ["__version__"]
22

3-
__version__ = "0.1.7"
3+
__version__ = "0.1.8"

tests/release/test_release_workflow.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,20 @@ def test_release_workflow_publishes_generated_release_notes() -> None:
5555
assert all(step["with"]["body_path"] == "release-notes.md" for step in upload_steps)
5656

5757

58+
def test_release_workflow_notifies_wecom_after_publish() -> None:
59+
workflow = yaml.safe_load(Path(".github/workflows/release.yml").read_text())
60+
61+
notify = workflow["jobs"]["notify"]
62+
step = next(step for step in notify["steps"] if step["name"] == "Notify WeCom release")
63+
64+
assert notify["needs"] == ["prepare", "release"]
65+
assert "needs.release.result == 'success'" in notify["if"]
66+
assert step["env"]["WECHAT_WEBHOOK_URL"] == "${{ secrets.WECHAT_WEBHOOK_URL }}"
67+
assert "WECHAT_WEBHOOK_URL secret is required" in step["run"]
68+
assert '"mentioned_list": ["@all"]' in step["run"]
69+
assert "curl -fsS" in step["run"]
70+
71+
5872
def test_generate_release_notes_script_outputs_changes_and_assets(tmp_path) -> None:
5973
script = Path(".github/scripts/generate_release_notes.py").resolve()
6074
repo = tmp_path / "repo"

0 commit comments

Comments
 (0)