From 29e723b5c1d2e953759e2735c3e68c8adee34491 Mon Sep 17 00:00:00 2001 From: Factiven Date: Fri, 4 Aug 2023 15:05:48 +0700 Subject: Update main.yml --- .github/workflows/main.yml | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to '.github') diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 878e5d2..57fbcc4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,29 +1,31 @@ +name: Create Release on Version Update + on: push: - # Sequence of patterns matched against refs/tags - tags: - - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 - -name: Create Release + branches: + - main jobs: - build: - name: Create Release + create_release: runs-on: ubuntu-latest + steps: - - name: Checkout code - uses: actions/checkout@v2 + - name: Check commit message and version + id: check_version + run: | + commit_message=$(git log -1 --pretty=format:%s) + version=$(echo $commit_message | grep -o -E "v[0-9]+\.[0-9]+\.[0-9]+" || true) + echo "Version found in commit message: $version" + echo "::set-output name=version::$version" + shell: bash + - name: Create Release id: create_release uses: actions/create-release@v1 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} - body: | - Changes in this Release - - First Change - - Second Change + tag_name: ${{ steps.check_version.outputs.version }} + release_name: Release ${{ steps.check_version.outputs.version }} draft: false prerelease: false -- cgit v1.2.3