Skip to content

Commit bdf6822

Browse files
committed
Test.
1 parent a374657 commit bdf6822

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

.github/workflows/gradle.yml

+12-14
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ jobs:
1515
- name: Prepare ch.txt content
1616
id: prepare_ch
1717
run: |
18-
git checkout test_ci
18+
cur_branch = "${{ github.ref_name }}"
19+
git checkout $cur_branch
1920
git remote add upstream https://github.com/chatty/chatty
2021
git fetch --all
21-
git branch test_ci --set-upstream-to upstream/master
22-
status_output=$(git status)
23-
echo "::set-output name=CH_CONTENT::$status_output"
22+
git branch $cur_branch --set-upstream-to upstream/master
23+
status_output=$(git rev-list --count upstream/master..origin/${cur_branch})
24+
echo "CH_CONTENT=$status_output" >> $GITHUB_OUTPUT
2425
2526
build:
2627
needs: prepare
@@ -42,10 +43,9 @@ jobs:
4243
distribution: 'adopt'
4344
java-version: '17'
4445

45-
- name: Create ch.txt and run version.py
46+
- name: Run version.py
4647
run: |
47-
echo "${{ needs.prepare.outputs.ch_content }}" > ch.txt
48-
python version.py
48+
python version.py "${{ needs.prepare.outputs.ch_content }}"
4949
5050
- name: Build with Gradle
5151
run: |
@@ -67,7 +67,7 @@ jobs:
6767
id: set_version
6868
run: |
6969
set /p new_tag_text=<final_version.txt
70-
echo "::set-output name=NEW_TAG_TEXT::%new_tag_text%"
70+
echo "NEW_TAG_TEXT=%new_tag_text%" >> $GITHUB_OUTPUT
7171
7272
build_mac_arm:
7373
needs: prepare
@@ -87,10 +87,9 @@ jobs:
8787
java-version: '17'
8888
architecture: arm64
8989

90-
- name: Create ch.txt and run version.py
90+
- name: Run version.py
9191
run: |
92-
echo "${{ needs.prepare.outputs.ch_content }}" > ch.txt
93-
python version.py
92+
python version.py "${{ needs.prepare.outputs.ch_content }}"
9493
9594
- name: Build with Gradle (ARM64)
9695
run: |
@@ -122,10 +121,9 @@ jobs:
122121
java-version: '17'
123122
architecture: x64
124123

125-
- name: Create ch.txt and run version.py
124+
- name: Run version.py
126125
run: |
127-
echo "${{ needs.prepare.outputs.ch_content }}" > ch.txt
128-
python version.py
126+
python version.py "${{ needs.prepare.outputs.ch_content }}"
129127
130128
- name: Build with Gradle (x64)
131129
run: |

version.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
import re
2+
import sys
23

3-
file = open('ch.txt','r');
4-
str = file.readlines()[1];
5-
sub = str[45:48];
6-
print(sub);
4+
# Check if at least one argument is provided
5+
if len(sys.argv) > 1:
6+
first_argument = sys.argv[1]
7+
print(f"First argument: {first_argument}")
8+
else:
9+
print("No arguments provided.")
710

811
partVersion = '0.28.0';
9-
finalVersion = f"{partVersion}.{sub}";
12+
finalVersion = f"{partVersion}.{first_argument}";
1013

1114
path = "src/chatty/Chatty.java";
1215
chatty = open(path, 'r');

0 commit comments

Comments
 (0)