-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(actions): Migliorata Auto Tag & Release (#50)
Migliorati titoli delle varie fasi dell'action con emoji e resi più esplicativi. Ora l'action genera un changelog migliore, personalizzabile e molto più completo. È in grado di capire ogni commit a quale catogiria appartiene (feat, fix, perf, chore, ecc.), prende tutti i commit di una PR mergiata (prima solo il commit di merge e basta), per ogni commit aggiunge l'id e l'autore, include alla fine il link all'intero Changelog (di GitHub). Il template con cui si genera il changelog è completamente personalizzabile: - è possibile modificare, aggiungere e togliere i gruppi - è possibile aggiungere testi prima, dopo e nei commit - è possibile aggiungere emoji e strutture in markdown È possibile controllare il bumping della versione aggiungendo al commit di merge specifici tag.
- Loading branch information
Showing
2 changed files
with
105 additions
and
18 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,18 @@ | ||
name: Auto Tag and Release | ||
name: Auto Tag and Release 🦧 | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
permissions: | ||
id-token: write | ||
contents: write | ||
packages: write | ||
pull-requests: read | ||
branches: [main, master] | ||
|
||
jobs: | ||
tag: | ||
name: Bumb Tag Version 🚀 | ||
runs-on: ubuntu-latest | ||
outputs: | ||
newtag: ${{ steps.tag.outputs.new-tag }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: phish108/[email protected] | ||
- name: Auto Tag | ||
uses: phish108/[email protected] | ||
id: tag | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN}} | ||
|
@@ -28,13 +22,34 @@ jobs: | |
release-branch: master | ||
dry-run: "true" | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
releasse: | ||
name: Create GitHub Release 📰 | ||
needs: tag | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: "marvinpinto/action-automatic-releases@latest" | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Generate changelog | ||
uses: orhun/git-cliff-action@v2 | ||
id: git-cliff | ||
with: | ||
config: .github/workflows/configs/conf.toml | ||
args: -vv --latest --unreleased --strip header --tag v${{needs.tag.outputs.newtag}} | ||
env: | ||
OUTPUT: CHANGES.md | ||
|
||
- name: Cat Changelog | ||
run: cat ${{ steps.git-cliff.outputs.changelog }} | ||
|
||
- name: Create Release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
automatic_release_tag: "v${{needs.tag.outputs.newtag}}" | ||
prerelease: false | ||
tag_name: "v${{needs.tag.outputs.newtag}}" | ||
release_name: "v${{needs.tag.outputs.newtag}}" | ||
body: ${{ steps.git-cliff.outputs.content }} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# configuration file for git-cliff (0.1.0) | ||
|
||
[changelog] | ||
# changelog header | ||
header = """ | ||
# Changelog\n | ||
All notable changes to this project will be documented in this file.\n | ||
""" | ||
# template for the changelog body | ||
# https://tera.netlify.app/docs/#introduction | ||
body = """ | ||
{% set github_repo_link = "https://github.com/Typing-Monkeys/AppuntiUniversita" %} | ||
{% for group, commits in commits | group_by(attribute="group") %} | ||
### {{ group | upper_first }} | ||
{% for commit in commits %} | ||
- {{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}]({{ github_repo_link }}/commit/{{ commit.id }})) by {{ commit.author.name }}\ | ||
{% endfor %} | ||
{% endfor %}\n | ||
**Full changelog: {{ github_repo_link }}/compare/{{ previous.version }}...{{ version }}**\n | ||
""" | ||
#postprocessors = [{ pattern = ".*", replace_command ='gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28 "/repos/ncvescera/provaactions/commits/$COMMIT_SHA | jq -r .author.login'}] | ||
# remove the leading and trailing whitespace from the template | ||
trim = true | ||
# changelog footer | ||
footer = """ | ||
<!-- generated by git-cliff --> | ||
""" | ||
# postprocessors= [ | ||
# #{pattern = "@username", replace_command='gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28 "/repos/ncvescera/provaactions/commits/$COMMIT_SHA | jq -r .author.login'}, | ||
# {patter="A", replace="X"}, | ||
# ] | ||
|
||
[git] | ||
# parse the commits based on https://www.conventionalcommits.org | ||
conventional_commits = true | ||
# filter out the commits that are not conventional | ||
filter_unconventional = false | ||
# process each line of a commit as an individual commit | ||
split_commits = false | ||
# regex for parsing and grouping commits | ||
|
||
# commit_preprocessors = [ | ||
# {pattern = "username", replace_command="gh api -H 'Accept: application/vnd.github+json' -H 'X-GitHub-Api-Version: 2022-11-28' /repos/ncvescera/provaactions/commits/$COMMIT_SHA | jq -r .author.login"}, | ||
# ] | ||
commit_parsers = [ | ||
{ message = "^feat", group = "Features 🚀"}, | ||
{ message = "^fix", group = "Fixes 🔨"}, | ||
{ message = "^doc", group = "Documentation 📝"}, | ||
{ message = "^perf", group = "Performance"}, | ||
{ message = "^refactor", group = "Refactor"}, | ||
{ message = "^style", group = "Styling"}, | ||
{ message = "^test", group = "Testing"}, | ||
{ message = "^chore\\(release\\): prepare for", skip = true}, | ||
{ message = "^chore", group = "Miscellaneous Tasks"}, | ||
{ body = ".*security", group = "Security"}, | ||
{ message = ".*", group = "Commits <img src='https://raw.githubusercontent.com/gilbarbara/logos/main/logos/git-icon.svg' width='20px' height='20px'>"}, | ||
] | ||
# protect breaking changes from being skipped due to matching a skipping commit_parser | ||
protect_breaking_commits = false | ||
# filter out the commits that are not matched by commit parsers | ||
filter_commits = false | ||
# glob pattern for matching git tags | ||
tag_pattern = "v[0-9]*" | ||
# regex for skipping tags | ||
skip_tags = "v0.1.0-beta.1" | ||
# regex for ignoring tags | ||
ignore_tags = "" | ||
# sort the tags topologically | ||
topo_order = false | ||
# sort the commits inside sections by oldest/newest order | ||
sort_commits = "oldest" |