2023-12-08 20:22:14 +08:00
|
|
|
name: Gitea Actions Demo
|
|
|
|
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
|
|
|
on: [push]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
Explore-Gitea-Actions:
|
|
|
|
runs-on: node-21
|
2023-12-08 23:15:52 +08:00
|
|
|
# 目前稳定能使用的 runner 就是 node 21 了
|
2023-12-08 20:22:14 +08:00
|
|
|
steps:
|
2023-12-08 23:15:52 +08:00
|
|
|
- name: 各种事件展示
|
|
|
|
run: |
|
|
|
|
echo "任务是由 ${{ gitea.event_name }} 事件触发的"
|
|
|
|
echo "你的分支是 ${{ gitea.ref }}"
|
|
|
|
echo "你的仓库是 ${{ gitea.repository }}"
|
2023-12-10 03:28:46 +08:00
|
|
|
ls ${{ gitea.workspace }}
|
2023-12-08 23:09:30 +08:00
|
|
|
|
2023-12-08 20:22:14 +08:00
|
|
|
- name: Check out repository code
|
2023-12-10 03:34:35 +08:00
|
|
|
uses: http://shenjack.top:5100/gitea-server/checkout@v4
|
2023-12-08 23:09:30 +08:00
|
|
|
|
2023-12-08 23:15:52 +08:00
|
|
|
- name: 展示其他信息
|
2023-12-08 20:22:14 +08:00
|
|
|
run: |
|
2023-12-08 23:15:52 +08:00
|
|
|
echo "你的分支是 ${{ gitea.ref }}"
|
|
|
|
echo "你的仓库是 ${{ gitea.repository }}"
|
|
|
|
echo "你的仓库路径是 ${{ gitea.workspace }}"
|
|
|
|
echo "这个 Action 的运行状态是 ${{ job.status }}"
|
2023-12-10 03:28:46 +08:00
|
|
|
ls ${{ gitea.workspace }}
|
2023-12-10 03:32:44 +08:00
|
|
|
cd ${{ gitea.workspace }}
|
|
|
|
ls ..
|
2023-12-08 23:15:52 +08:00
|
|
|
|
|
|
|
- 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
|