Skip to content

Commit e4bfaf2

Browse files
committed
ci: test
1 parent 034d777 commit e4bfaf2

1 file changed

Lines changed: 3 additions & 62 deletions

File tree

Lines changed: 3 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,12 @@
11
name: Check new version
22

33
on:
4+
push:
45
workflow_dispatch:
56
schedule:
67
- cron: '0 0 1 * *' # every month first day
78

89
jobs:
910
build:
10-
permissions:
11-
contents: write
12-
pull-requests: write
13-
runs-on: ubuntu-latest
14-
steps:
15-
- uses: actions/checkout@v4
16-
17-
- name: Checkout latest code
18-
uses: actions/checkout@v4
19-
with:
20-
repository: "libass/libass"
21-
path: 'latest_code'
22-
fetch-depth: 0
23-
24-
- name: Get latest verion
25-
id: version
26-
run: |
27-
cd ./latest_code
28-
latest_tag=$(git tag --sort=-v:refname | grep -v "-" | head -n 1)
29-
echo "latest tag: $latest_tag"
30-
echo "LATEST_VERSION=$latest_tag" >> $GITHUB_ENV
31-
rm -rf ../latest_code
32-
33-
- name: update to new version
34-
uses: jannekem/run-python-script-action@v1
35-
with:
36-
script: |
37-
import re
38-
39-
def parse_version(ver):
40-
if '-' in ver or ver == '':
41-
return 0
42-
return int(re.sub(r'[^0-9]+', r'', ver))
43-
44-
file_path = './Sources/BuildScripts/XCFrameworkBuild/main.swift'
45-
with open(file_path, 'r', encoding='utf-8') as file:
46-
content = file.read()
47-
oldVersion = re.search(r'(case .libass[^"]+?)"(.+?)"', content).group(2)
48-
print("old version:", oldVersion)
49-
set_env('OLD_VERSION', oldVersion)
50-
newVersion = '${{ env.LATEST_VERSION }}'
51-
print("new version:", newVersion)
52-
if parse_version(newVersion) > parse_version(oldVersion):
53-
content = re.sub(r'(case .libass[^"]+?)"(.+?)"', r'\1"${{ env.LATEST_VERSION }}"', content, count=1)
54-
set_env('FOUND_NEW_VERSION', '1')
55-
with open(file_path, 'w', encoding='utf-8') as file:
56-
file.write(content)
57-
58-
59-
- name: Create Pull Request
60-
if: env.FOUND_NEW_VERSION
61-
uses: peter-evans/create-pull-request@v6
62-
with:
63-
add-paths: |
64-
./Sources/BuildScripts/XCFrameworkBuild/main.swift
65-
title: "bump version to ${{ env.LATEST_VERSION }}"
66-
body: |
67-
https://github.com/libass/libass/blob/${{ env.LATEST_VERSION }}/Changelog
68-
69-
https://github.com/libass/libass/compare/${{ env.OLD_VERSION }}...${{ env.LATEST_VERSION }}
70-
commit-message: "chore: bump version to ${{ env.LATEST_VERSION }}"
71-
11+
uses: mpvkit/action/.github/workflows/check_version.yml
12+
secrets: inherit

0 commit comments

Comments
 (0)