diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 28ae026..4f42680 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -61,20 +61,27 @@ jobs: run: | TYPES=("minor_changes" "major_changes" "bugfixes" "deprecated_features" "removed_features" "breaking_changes") TAG=$(git describe --abbrev=0 --tags) - PRS=($(comm -12 <(git log --oneline ${TAG}.. --format="tformat:%H" | sort ) <(hub pr list -s all -f '%sm%n' --color=never | sort ))) - IFS=$'\n' FRAGMENTS=($(hub pr list -s all -f '%sm~%I~%L~%t~%n' --color=never| grep -P "$(echo "^(${PRS[@]})" | tr ' ' '|')")) - for frag in "${FRAGMENTS[@]}"; do - PR=$(echo $frag|cut -d~ -f2) - type="$(echo $frag|cut -d~ -f3)" - msg="$(echo $frag|cut -d~ -f4|sed 's/`/``/g')" - if [[ "${TYPES[*]}" =~ "${type}" ]]; then - echo -e "$type:\n - >\n $msg \`#${PR} \`_" \ - > changelogs/fragments/${PR}.yaml - fi - done - antsibull-changelog lint -vvv if [[ "${{github.ref}}" == "refs/heads/main" ]]; then - antsibull-changelog release --version "$(grep version galaxy.yml | awk -F'"' '{ print $2 }')-devel" -v + PRS=($(comm -12 <(git log --oneline ${TAG}.. --format="tformat:%H" | sort ) <(hub pr list -s all -f '%sm%n' --color=never | sort ))) + else + PREV_TAG=$(git tag | grep -P "^[0-9]+[.][0-9]+[.][0-9]+$" | sort --version-sort -r | head -n2 | grep -v "${TAG}") + PRS=($(comm -12 <(git log --oneline ${PREV_TAG}..${TAG} --format="tformat:%H" | sort ) <(hub pr list -s all -f '%sm%n' --color=never | sort ))) + fi + if [[ ${#PRS[@]} > 0 ]]; then + IFS=$'\n' FRAGMENTS=($(hub pr list -s all -f '%sm~%I~%L~%t~%n' --color=never | grep -P "$(echo "^(${PRS[@]})" | tr ' ' '|')")) + for frag in "${FRAGMENTS[@]}"; do + PR=$(echo $frag|cut -d~ -f2) + type="$(echo $frag|cut -d~ -f3)" + msg="$(echo $frag|cut -d~ -f4|sed 's/`/``/g')" + if [[ "${TYPES[*]}" =~ "${type}" ]]; then + echo -e "$type:\n - >\n $msg \`#${PR} \`_" \ + > changelogs/fragments/${PR}.yaml + fi + done + antsibull-changelog lint -vvv + if [[ "${{github.ref}}" == "refs/heads/main" ]]; then + antsibull-changelog release --version "$(grep version galaxy.yml | awk -F'"' '{ print $2 }')-devel" -v + fi fi working-directory: ansible_collections/middleware_automation/keycloak env: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 48c29ac..a95c5ad 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -90,7 +90,7 @@ jobs: run: | git config user.name github-actions git config user.email github-actions@github.com - git tag -a ${{ steps.get_version.outputs.TAG_VERSION }}" -m "Release v${{ steps.get_version.outputs.TAG_VERSION }}" || true + git tag -a ${{ steps.get_version.outputs.TAG_VERSION }} -m "Release v${{ steps.get_version.outputs.TAG_VERSION }}" || true git push origin --tags - name: Publish Release diff --git a/galaxy.yml b/galaxy.yml index 195f396..0e6d34d 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -31,4 +31,4 @@ build_ignore: - molecule - .github - '*.tar.gz' - - '*.zip' \ No newline at end of file + - '*.zip'