From 9843eb36b2485ebb3e0ef95033d6f7f29f47d907 Mon Sep 17 00:00:00 2001 From: chenslucky <75061414+chenslucky@users.noreply.github.com> Date: Wed, 23 Aug 2023 12:01:07 +0800 Subject: [PATCH] Add tool create release tag pipeline (#127) Add a pipeline to create release tag for promptflow-tools. **Template example**: ![image](https://github.com/microsoft/promptflow/assets/75061414/3a4b1c6e-ddef-424b-b313-4f861698e50a) --------- Co-authored-by: cs_lucky --- .github/workflows/tools_release_tag.yml | 69 +++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/workflows/tools_release_tag.yml diff --git a/.github/workflows/tools_release_tag.yml b/.github/workflows/tools_release_tag.yml new file mode 100644 index 00000000000..f3ee1a347fb --- /dev/null +++ b/.github/workflows/tools_release_tag.yml @@ -0,0 +1,69 @@ +name: Promptflow Tools Release Tag +on: + workflow_dispatch: + inputs: + TagVersion: + description: 'Tag version' + required: true + default: 'v1.0.0' + type: string + ReleaseName: + description: 'Release name' + required: true + default: 'v1.0.0' + type: string + PreRelease: + description: 'Whether it is a pre-release' + required: true + default: true + type: boolean + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Get last tag version + run: | + version=$(git tag | tail -1) + echo "last_tag_version=$version" >> $GITHUB_ENV + + - name: Generate release notes + run: | + echo "# **What's Changed**" > ./src/promptflow-tools/CHANGELOG.md + git log ${{ env.last_tag_version }}.. --pretty=format:"%H %s @%an" -- ./src/promptflow-tools/ >> ./src/promptflow-tools/CHANGELOG.md + echo " " >> ./src/promptflow-tools/CHANGELOG.md + echo " " >> ./src/promptflow-tools/CHANGELOG.md + echo "**Full Changelog**: https://github.com/microsoft/promptflow/compare/${{ env.last_tag_version }}...${{ inputs.TagVersion }}" >> ./src/promptflow-tools/CHANGELOG.md + + - name: Zip folder + run: | + cd src + zip -r promptflow-tools.zip promptflow-tools + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ inputs.TagVersion }} + release_name: ${{ inputs.ReleaseName }} + body_path: ./src/promptflow-tools/CHANGELOG.md + draft: false + prerelease: ${{ inputs.PreRelease }} + + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./src/promptflow-tools.zip + asset_name: promptflow-tools.zip + asset_content_type: application/zip \ No newline at end of file