-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5059788
commit af41663
Showing
2 changed files
with
14 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
# -*- coding: utf-8 -*- | ||
import os | ||
|
||
|
||
def 查看系统所有环境变量(): | ||
from icecream import ic | ||
# 打印系统所有的环境变量 | ||
for item in os.environ: | ||
name = item | ||
value = os.environ[item] | ||
ic(name, value) | ||
查看系统所有环境变量() | ||
|
||
# 查看系统所有环境变量() | ||
tagName = os.environ.get('GITHUB_REF_NAME') | ||
print("tagName:", tagName) | ||
# 获取运行目录 | ||
print("run dir:", os.getcwd()) | ||
# print("run dir:", os.getcwd()) | ||
# 获取文件目录 | ||
文件目录 = os.path.dirname(__file__) | ||
print("file dir:", os.path.dirname(__file__)) | ||
versionFilePath = os.path.join(文件目录, "version.txt") | ||
print("edit file {versionFilePath} output: version = {tagName}") | ||
# 覆盖写出文件 version.py 中 | ||
with open(f'{文件目录}/version.py', 'w') as f: | ||
with open(versionFilePath, 'w') as f: | ||
f.write(f'version = "{tagName}"') | ||
|
||
exit() |