@@ -10,30 +10,63 @@ jobs:
1010 release :
1111 runs-on : ubuntu-20.04
1212 steps :
13- - name : Build Changelog
14- if : contains(github.event.pull_request.labels.*.name, 'kind/release')
15- id : github_release
16- uses : mikepenz/release-changelog-builder-action@v3
17- with :
18- configuration : " configuration.json"
19- env :
20- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
13+ - name : Checkout
14+ uses : actions/checkout@v3
2115
2216 - name : Get release version
2317 id : get_version
24- if : contains(github.event.pull_request.labels.*.name, 'kind/release')
18+ if : ${{ contains(github.event.pull_request.labels.*.name, 'kind/release') && github.event.pull_request.merged == true }}
2519 run : |
26- VERSION=$( echo "${{ github.event.pull_request.labels.*.name }}" | grep -E '^ [[:digit:]]+.[[:digit:]]+.[[:digit:]]$ ')
20+ VERSION=$( echo "${{ github.event.pull_request.title }}" | grep -oE ' [[:digit:]]+.[[:digit:]]+.[[:digit:]]')
2721 if [[ -n $VERSION ]]; then
2822 echo "::set-output name=version::$VERSION"
2923 fi
3024
25+ - name : Not version added
26+ if : ${{ !steps.get_version.outputs.version }}
27+ run : |
28+ echo "::error No version added"
3129 - name : Create Release
32- if : contains(github.event.pull_request.labels.*.name, 'kind/release') && ${{ steps.get_version.outputs.version }}
30+ if : ${{ contains(github.event.pull_request.labels.*.name, 'kind/release') && steps.get_version.outputs.version && github.event.pull_request.merged == true }}
3331 uses : actions/create-release@v1.1.4
3432 with :
3533 tag_name : ${{ steps.get_version.outputs.version }}
3634 release_name : ${{ steps.get_version.outputs.version }}
37- body : ${{steps.github_release.outputs.changelog}}
3835 env :
3936 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
37+
38+ - name : Build Changelog for hotfix changes
39+ if : ${{ contains(github.event.pull_request.labels.*.name, 'kind/release') && startsWith(github.head_ref, 'hotfix/') && github.event.pull_request.merged == true }}
40+ uses : saadmk11/changelog-ci@v1.0.0
41+ with :
42+ config_file : " changelog-configuration.yml"
43+ env :
44+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
45+
46+ - name : Checkout
47+ uses : actions/checkout@v3
48+ with :
49+ fetch-depth : 0
50+ ref : ${{ github.base_ref }}
51+
52+ - name : Set changes in develop branch
53+ if : ${{ github.event.pull_request.merged == true }}
54+ env :
55+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
56+ run : |
57+ DEVELOP=${BASELINE_BRANCH/main/develop}
58+ git checkout -b automated/sync-from-${{ github.event.pull_request.number }}-to-develop
59+ git push --no-verify -u origin HEAD
60+ gh pr create \
61+ --title "Sincronizar develop con main" \
62+ --base "$DEVELOP" \
63+ --body "**Pull Request automática** relacionada con #${{ github.event.pull_request.number }}"
64+
65+ - name : Add PR comment - On Failure
66+ if : failure()
67+ env :
68+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
69+ run : |
70+ gh pr comment ${{ github.event.number }} --body "
71+ ### :exclamation: :exclamation: :exclamation: Sync to develop failure
72+ - See the [workflow log](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})."
0 commit comments