0

Github Action入门指南

 1 year ago
source link: https://yikun.github.io/2020/02/28/Github-Action%E5%85%A5%E9%97%A8%E6%8C%87%E5%8D%97/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

这里记录一下Github Action的从入门到还没放弃的历程。 :)

1. Hello World

我们可以通过repo的action的指引,快速的完成Github action的测试:
image
点击detail后,我们便可以完成Hello world的测试:
image

可以看到,整个过程非常简单,只需要提交一个位于.github/hello-wrold.yml的文件:

name: CI
# 在push的时候触发这个workflow
on: [push]
# workflow的job内容
jobs:
build:
# 跑job的系统
runs-on: ubuntu-latest
# 定义需要跑的脚本
steps:
# 使用checkout action
- uses: actions/checkout@v2
# Hello World
- name: Run a one-line script
run: echo Hello, world!
# 打印多行
- name: Run a multi-line script
run: |
echo Add other actions to build,
echo test, and deploy your project.

我们可以点击detail进入Workflow的结果页面

image

2. 初识Action

官方的文档介绍的非常详细了,这里推荐一些文章,官方在action的文档主页中推荐了3个文章,这里简单介绍下:

  • About GitHub Actions
    这篇文章主要从从使用者的角度对action进行了简单的介绍,通过这篇文章可以了解到使用Github action的一些注意事项(例如使用限制、通知机制等都在这里有提及)。

  • Configuring a workflow
    这篇文章可以认为是对workflow的一个详解,并且对workflow中的关键概念进行了解释,把这篇文章读透,基本上Github Action的基础功能就了然于胸了。

  • About actions
    这篇文章可以认为是写给action的开发者的一个入门文档,在你需要写一个action之前,建议通读这篇文章。

3. 高级功能

在这节会陆续更新下,我使用到的有用的功能:


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK