From 0e64c9e56cf586a73a6c9eabfb26cbaa229be825 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Fri, 8 Dec 2023 23:15:52 +0800 Subject: [PATCH] add readme and more MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 试着加个这玩意 Fix | 应该是 r+ auto update with Gitea Actions 尝试一些新东西( 我的问题( auto update with Gitea Actions 2? 待会得 squash了 auto update with Gitea Actions 好好好 now? auto update with Gitea Actions 是这样? reeee 好好好 再试一次 得了,新建一个分支吧 try try 忘记 push -f 了( --- .gitea/workflows/demo.yaml | 46 ++++++++++++++++++++++++++------------ readme.md | 7 ++++++ run.py | 12 ++++++++++ test.md | 0 4 files changed, 51 insertions(+), 14 deletions(-) create mode 100644 readme.md create mode 100644 run.py create mode 100644 test.md diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/demo.yaml index 2e4ab92..ae739c6 100644 --- a/.gitea/workflows/demo.yaml +++ b/.gitea/workflows/demo.yaml @@ -5,24 +5,42 @@ on: [push] jobs: Explore-Gitea-Actions: runs-on: node-21 + # 目前稳定能使用的 runner 就是 node 21 了 steps: - - run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event." - - - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!" - - - run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}." + - name: 各种事件展示 + run: | + echo "任务是由 ${{ gitea.event_name }} 事件触发的" + echo "你的分支是 ${{ gitea.ref }}" + echo "你的仓库是 ${{ gitea.repository }}" - name: Check out repository code uses: http://shenjack.top:5100/mirror/checkout@v4 - - run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner." - - - run: echo "🖥️ The workflow is now ready to test your code on the runner." - - - name: List files in the repository + - name: 展示其他信息 run: | - ls ${{ gitea.workspace }} + echo "你的分支是 ${{ gitea.ref }}" + echo "你的仓库是 ${{ gitea.repository }}" + echo "你的仓库地址是 ${{ gitea.repository_url }}" + echo "你的仓库路径是 ${{ gitea.workspace }}" + echo "你的仓库地址是 ${{ gitea.workspace_url }}" + echo "这个 Action 的运行状态是 ${{ job.status }}" + echo ls ${{ gitea.workspace }} - - run: echo "🍏 This job's status is ${{ job.status }}." - - - run: python3 test.py \ No newline at end of file + - name: 展示 python 版本 + run: | + python3 test.py + python3 -c "import sys;print(sys.version)" + python3 run.py + + - name: 推送修改 + run: | + git config user.name gitea-actions + git config user.email gitea-action@shenjack.top + git add . + git commit -m "auto update with Gitea Actions" + # 创建并切换到deploy分支 + git checkout -b deploy + # 将更改添加到deploy分支的最新提交 + git commit --amend --no-edit + # 推送到deploy分支 + git push origin HEAD --force diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..bfa6e57 --- /dev/null +++ b/readme.md @@ -0,0 +1,7 @@ +# Gitea Action Demo 展示 + +欢迎来到这里! + +这里是一个 Gitea action 的展示仓库, 你可以在这里看到 Gitea action 的效果. + +同时你也可以参考这里编写的 mirros 来在编写你自己的 action 的时候使用本地镜像来加速使用 diff --git a/run.py b/run.py new file mode 100644 index 0000000..896a38f --- /dev/null +++ b/run.py @@ -0,0 +1,12 @@ +import time + + +with open('test.md', 'r+', encoding='utf-8') as md_file: + md = md_file.read() + print(md) + + md_file.write('hello action!') + md_file.write(f'greeting from {time.time()}\n') + date_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) + md_file.write(date_time) + md_file.write('\n') diff --git a/test.md b/test.md new file mode 100644 index 0000000..e69de29