Skip to content

Commit

Permalink
ci(.github/workflows/): eleChoPlugin-release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
yiyungent committed Jun 9, 2023
1 parent 1d33ad6 commit b0ec04b
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/EleChoPlugin-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: EleChoPlugin Release

on:
push:
tags:
- 'EleChoPlugin-v*'

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Checkout source
uses: actions/checkout@v2
with:
# 为了让 git 有日志 (git log) 可寻,还得在检出的时候顺带把所有提交历史一并拉下来,指定 fetch-depth 就能做到
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod

- name: Set outputs
id: vars
run: |
tagPrefix=refs/tags/EleChoPlugin-
# 获取字符串长度
tagPrefixLen=${#tagPrefix}
# 去掉前面的 refs/tags/EleChoPlugin-
RELEASE_VERSION=${GITHUB_REF:$tagPrefixLen}
# 提取出 v1.0.0
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_OUTPUT
shell: bash

- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.100

- name: Build
run: |
cd ./plugins/EleChoPlugin
dotnet build --configuration Release
ls
ls ./bin/Release/
ls ./bin/Release/net6.0/
shell: bash

- name: Zip the Build
run: |
cd ./plugins/EleChoPlugin/bin/Release/net6.0
zip -r EleChoPlugin-${{ steps.vars.outputs.RELEASE_VERSION }}-net6.0.zip *
shell: bash

- name: Create temp-release-note.md
run: |
cp utils/generate-release-note.ps1 generate-release-note.ps1
$env:GitProjectTagName="EleChoPlugin"
$env:GitProjectPath="plugins/EleChoPlugin/*"
./generate-release-note.ps1
shell: pwsh

- name: Create Release and Upload Release Asset
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
#tag_name: ${{ github.ref }}
#name: ${{ github.ref }}
# body: TODO New Release.
body_path: temp-release-note.md
draft: false
prerelease: false
files: |
./plugins/EleChoPlugin/bin/Release/net6.0/EleChoPlugin-${{ steps.vars.outputs.RELEASE_VERSION }}-net6.0.zip
./plugins/EleChoPlugin/README.md
./plugins/EleChoPlugin/LICENSE

0 comments on commit b0ec04b

Please sign in to comment.