Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(actions): Migliorata Auto Tag & Release #50

Merged
merged 2 commits into from
Jul 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 33 additions & 18 deletions .github/workflows/autorelease.yml
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}}
Expand All @@ -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 }}

72 changes: 72 additions & 0 deletions .github/workflows/configs/conf.toml
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"