前言
最近使用 Deno 开发了一个小工具(Swagger2Code),又使用 GitHub action 做自动发布到 Release。在此之前也使用过 GitHub action 做过类似的,比如博客自动发布到 GitHub pages,功能相比简单一些。
步骤
1. 准备仓库
准备一个 github 仓库,(私有、公开)都是可以的。
2. 创建 action
在仓库的 .github/workflows
目录下创建一个 release.yml
文件,当然也可以选择一个官方提供的模板。已官方的 deno.yml
为例,可以看到如下内容:
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will install Deno then run `deno lint` and `deno test`.
# For more information see: https://github.com/denoland/setup-deno
name: Deno
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Setup repo
uses: actions/checkout@v3
- name: Setup Deno
# uses: denoland/setup-deno@v1
uses: denoland/setup-deno@9db7f66e8e16b5699a514448ce994936c63f0d54
with:
deno-version: v1.x
# Uncomment this step to verify the use of 'deno fmt' on each commit.
# - name: Verify formatting
# run: deno fmt --check
- name: Run linter
run: deno lint
- name: Run tests
run: deno test -A