create_tools_release_tag #23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: create_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 | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get last tag version | |
run: | | |
version=$(git tag -l '*-tools' | sort -V | tail -n 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 |