github.com/team-ide/go-dialect@v1.9.20/.github/workflows/release.yml (about) 1 name: release 2 on: 3 push: 4 # tags: # 当我们提交代码为tag 是以'v'开头的时候才会触发自动部署到服务端 如 git push tag v0.1.0 5 # - 'v*' 6 branches: 7 - main 8 # - dev 9 # package.json 更改后再触发发布 10 # paths: [ "package.json" ] 11 jobs: 12 13 release: 14 runs-on: ubuntu-latest 15 steps: 16 17 - name: Checkout git repo 18 uses: actions/checkout@v1 19 20 # 读取发布版本 21 - name: Read Release Version 22 id: release_version 23 uses: ashley-taylor/read-json-property-action@v1.0 24 with: 25 path: package.json 26 property: version 27 28 - id: release_check 29 run: | 30 echo "::set-output name=RELEASE_STATUS::$(curl -I -m 10 -o /dev/null -s -w %{http_code} https://github.com/team-ide/go-dialect/releases/tag/v${{ steps.release_version.outputs.value }})" 31 32 # 读取发布说明 33 - name: Read Release Description 34 id: release_body 35 if: ${{ steps.release_check.outputs.RELEASE_STATUS == 404 }} 36 uses: juliangruber/read-file-action@v1 37 with: 38 path: RELEASE.md 39 40 # 发布 41 - name: Create Release 42 id: create_release 43 if: ${{ steps.release_check.outputs.RELEASE_STATUS == 404 }} 44 uses: actions/create-release@v1 45 env: 46 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 47 with: 48 tag_name: v${{steps.release_version.outputs.value}} 49 release_name: v${{steps.release_version.outputs.value}} 50 body: ${{steps.release_body.outputs.content}} 51 draft: false # 是否是草稿 52 prerelease: false # 是否是预发布