Skip to content

Commit a073abf

Browse files
author
Pablo Collazo Collarte
authored
Merge pull request #54 from pablocollazoc/hotfix/GH-52-el-workflow-de-release-no-funciona-correctament
Release 0.1.1
2 parents d9f26d9 + d6f523d commit a073abf

File tree

5 files changed

+118
-83
lines changed

5 files changed

+118
-83
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: generate-changelog
3+
4+
on:
5+
pull_request:
6+
types: [opened]
7+
branches: ["main", "main-*"]
8+
9+
jobs:
10+
release:
11+
runs-on: ubuntu-20.04
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
16+
- name: Build Changelog
17+
if: contains(github.event.pull_request.labels.*.name, 'kind/release')
18+
uses: saadmk11/changelog-ci@v1.0.0
19+
with:
20+
config_file: "changelog-configuration.yml"
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 45 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -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 }})."

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Version: 0.1.1
2+
3+
4+
#### Bug Fixes
5+
6+
* [#45](https://github.com/pablocollazoc/microflow/pull/45): fix: update readme
7+
8+
#### New Features
9+
10+
* [#48](https://github.com/pablocollazoc/microflow/pull/48): Creación de flujo de release
11+
12+
#### Test
13+
14+
* [#49](https://github.com/pablocollazoc/microflow/pull/49): test: update readme
15+
16+
#### Unlabeled Changes
17+
18+
* [#46](https://github.com/pablocollazoc/microflow/pull/46): Release 0.2.0
19+
* [#47](https://github.com/pablocollazoc/microflow/pull/47): Merge pull request #46 from pablocollazoc/develop
20+
* [#51](https://github.com/pablocollazoc/microflow/pull/51): Merge pull request #50 from pablocollazoc/develop
21+
* [#50](https://github.com/pablocollazoc/microflow/pull/50): Release 0.2.0

changelog-configuration.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
changelog_type: 'pull_request' # or 'pull_request'
2+
header_prefix: 'Version:'
3+
commit_changelog: true
4+
comment_changelog: true
5+
include_unlabeled_changes: true
6+
unlabeled_group_title: 'Unlabeled Changes'
7+
group_config:
8+
- title: Bug Fixes
9+
labels:
10+
- kind/bug
11+
- kind/bugfix
12+
- title: Hotfix
13+
labels:
14+
- kind/hotfix
15+
- title: Code Improvements
16+
labels:
17+
- kind/improvements
18+
- kind/enhancement
19+
- title: New Features
20+
labels:
21+
- kind/feature
22+
- kind/refactoring
23+
- title: Documentation Updates
24+
labels:
25+
- kind/docs
26+
- kind/documentation
27+
- kind/doc
28+
- title: Test
29+
labels:
30+
- kind/test

configuration.json

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)