predixy/.github/workflows/release.yml
2022-11-20 13:16:02 +08:00

43 lines
1.6 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name: Publish And Deploy Demo # 自动部署的名称
on:
push:
master: # 当我们提交代码为tag 是以'v'开头的时候才会触发自动部署到服务端 如 git push tag v0.1.0
jobs:
build-and-deploy:
runs-on: ubuntu-latest # 运行环境,告诉它运行在什么环境
steps: # 步骤
# 第一步下载源码CI/CD拉取代码到自己的本地
- name: Checkout
uses: actions/checkout@master
# 第二步:打包构建
- name: Build
uses: actions/setup-make@master
- run: make # 安装第三方包
# 第三步:发布 Release
- name: Create Release # 创建Release可以在仓库看到一个个版本
id: create_release
uses: actions/create-release@master
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }} # 之前GitHub添加的Token
with:
tag_name: ${{ github.ref }} # (tag)标签名称
release_name: Release ${{ github.ref }}
draft: false # 是否是草稿
prerelease: false # 是否是预发布
# 第四步:上传构建结果到 Release把打包的tgz上传到Release
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@master
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # 上传地址通过创建Release获取到的
asset_path: ./release.tgz # 要上传文件
asset_name: release.tgz # 上传后的文件名
asset_content_type: application/x-tgz