-
Notifications
You must be signed in to change notification settings - Fork 45
75 lines (66 loc) · 2.73 KB
/
sync_base_version.yml
File metadata and controls
75 lines (66 loc) · 2.73 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
# Copyright (c) 2026 Huawei Technologies Co., Ltd.
# This program is free software, you can redistribute it and/or modify it under the terms and conditions of
# CANN Open Software License Agreement Version 2.0 (the "License").
# Please refer to the License for details. You may not use this file except in compliance with the License.
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
# See LICENSE in the root of the software repository for the full text of the License.
name: Sync Base Version
on:
delete:
workflow_dispatch:
inputs:
version:
description: Optional explicit base version (for example 0.17 or v0.17)
required: false
type: string
release:
types: [deleted]
permissions:
contents: write
jobs:
sync-base-version:
if: >
github.repository == 'zhangstevenunity/PTOAS' &&
(
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'delete' && github.event.ref_type == 'tag') ||
(github.event_name == 'release' && github.event.action == 'deleted')
)
runs-on: ubuntu-latest
steps:
- name: Checkout default branch
uses: actions/checkout@v4
with:
ref: ${{ github.event.repository.default_branch }}
fetch-depth: 0
fetch-tags: true
- name: Refresh tags
run: |
git fetch --force --tags origin
- name: Sync CMake base version
id: sync
shell: bash
run: |
set -euo pipefail
manual_version="${{ github.event.inputs.version || '' }}"
if [ -n "${manual_version}" ]; then
target_version="$(python3 .github/scripts/update_ptoas_base_version.py --version "${manual_version}")"
else
target_version="$(python3 .github/scripts/update_ptoas_base_version.py --from-git-tags --next)"
fi
echo "target_version=${target_version}" >> "${GITHUB_OUTPUT}"
echo "Synchronized base version to ${target_version}"
- name: Commit synced base version
shell: bash
run: |
set -euo pipefail
if git diff --quiet -- CMakeLists.txt; then
echo "CMakeLists.txt already matches the target base version."
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add CMakeLists.txt
git commit -m "chore(release): sync base version to v${{ steps.sync.outputs.target_version }}"
git push origin HEAD:${{ github.event.repository.default_branch }}