Github Action 尝鲜

发现GitHub上有个Action功能. 查阅后,感觉它能当成一个远端的服务器用.
于是搜寻教程,自动在库 .github/workflows/目录下创建了.yml文件.
配置一下这个文件基本就万事大吉了.

主要实现让自己仓库里的文件能在action理运行, 并且让github回传送txt文件

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
name: Run Python & up .txt file
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Run python
run: |
git clone https://github.com/Ackermannn/TestAction.git
python hello.py
- name: Up something
run: |
mkdir -p path/to/artifact
echo hello > path/to/artifact/world.txt
- uses: actions/upload-artifact@v1
with:
name: my-artifact
path: path/to/artifact

参考链接:

阮一峰的网络日志:GitHub Actions 入门教程

action/setup-python的官方文档

actions/upload-artifact