-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (82 loc) · 3.04 KB
/
push_lib_widget.yml
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: push_lib_widget
on:
push:
paths:
- '**'
jobs:
prepare:
runs-on: ubuntu-latest
container:
image: registry.cn-shanghai.aliyuncs.com/dango/android_ci:latest # 指定您的自定义 Docker 镜像及其标签
options: --platform linux/amd64
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: 检查当前版本
id: generate_version
run: |
# Generate a new version code based on the previous one
prev_version=$(grep "VERSION_NAME" lib/widget/gradle.properties | grep -o '[0-9]\+$')
new_version=$((prev_version + 1))
formatted_version=$(printf "%04d" "$new_version")
echo "$formatted_version"
echo "new_version=$formatted_version" >> $GITHUB_OUTPUT
- name: 之前保存的版本号
run: |
echo "new_version = ${{ steps.generate_version.outputs.new_version }}"
- name: 修改本地版本号
run: |
# Update the versionCode in the build file
sed -i 's/\([0-9]\+\)$/${{ steps.generate_version.outputs.new_version }}/' lib/widget/gradle.properties
- name: 打印本地版本号
run: |
# Update the versionCode in the build file
grep "VERSION_NAME" lib/widget/gradle.properties | grep '[0-9]\+$'
- name: 上传2
run: |
pwd
git config --global --add safe.directory /__w/DangoUnit/DangoUnit
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
git add .
git commit -am "Update versionCode"
echo ${{ secrets.PERSONAL_ACCESS_TOKEN }}
git push https://[email protected]/Dango-dx/DangoUnit.git HEAD:master
env:
PAT: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
build:
runs-on: ubuntu-latest
container:
image: registry.cn-shanghai.aliyuncs.com/dango/android_ci:latest # 指定您的自定义 Docker 镜像及其标签
options: --platform linux/amd64
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: 打印环境变量
run: |
env
- name: Display Commit SHA
run: |
echo "Current Commit SHA: ${{ github.sha }}"
- name: Display Branch/Tag Name
run: |
echo "Current Ref: ${{ github.ref }}"
- name: Display Commit Author
run: |
echo "Commit Author: ${{ github.actor }}"
echo "Commit Author: ${{ github.actor }}"
- name: Display Repository Name
run: |
echo "Repository: ${{ github.repository }}"
# 获取git log
- name: Get git log
id: git_log
run: |
pwd
git config --global --add safe.directory /__w/DangoUnit/DangoUnit
updateLog=`git log --pretty=format:"%s" -1`
echo "updateLog=$updateLog" >> $GITHUB_ENV
git log --pretty=format:"%s" -1
- name: Show Latest Commit
run: |
git log -n 1