Skip to content

Commit

Permalink
fix: workflow formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
j-i-l committed Aug 16, 2024
1 parent 8f1c3c1 commit 4c8799d
Showing 1 changed file with 46 additions and 46 deletions.
92 changes: 46 additions & 46 deletions .github/workflows/initiate_version_stub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,53 +17,53 @@ jobs:
pull-requests: write
repository-projects: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # NOTE: This might be needed to assert that we get the full history
# for the changelog.
- uses: actions/checkout@v4
with:
fetch-depth: 0 # NOTE: This might be needed to assert that we get the full history
# for the changelog.

- name: Register desired version
id: release_version
run: |
# get the previous clean (i.e. no -rc ) version
# first fetch all the tags
git fetch --filter=tree:0 origin +refs/tags/*:refs/tags/*
echo "VERSION=`echo $(echo '${{ github.ref_name }}'|grep -Eo '[0-9]+.[0-9]+.[0-9]+')`" >> $GITHUB_OUTPUT
echo "PREVIOUS_VERSION=`echo $(git tag --list --sort=version:refname | grep -E '^[0-9]+.[0-9]+.[0-9]+$' | tail -n1)`" >> $GITHUB_OUTPUT
echo "AUTHOR=`echo $(git log -1 --pretty=%an)`" >> $GITHUB_OUTPUT
- name: Get git-chglog and update CHANGELOG
run: |
wget ${{ env.CHGLOG_PATH }}/${{ env.CHGLOG_RELEASE}}.tar.gz # get the binary for the chglog
tar --extract --file=${{ env.CHGLOG_RELEASE}}.tar.gz git-chglog
# update the changelog only for this tag
./git-chglog --tag-filter-pattern="[0-9]+.[0-9]+.[0-9]+${{ '$' }}|${{ github.ref_name}}" -o _tmpCHLOG.md ${{ github.ref_name }}
cat _tmpCHLOG.md CHANGELOG.md > new_CHLOG.md && mv new_CHLOG.md CHANGELOG.md
# now we substitute the clean tag
sed -i -e "s/${{ github.ref_name }}/${{ steps.release_version.outputs.version}}/g" CHANGELOG.md
rm git-chglog
- name: Register desired version
id: release_version
run: |
# get the previous clean (i.e. no -rc ) version
# first fetch all the tags
git fetch --filter=tree:0 origin +refs/tags/*:refs/tags/*
echo "VERSION=`echo $(echo '${{ github.ref_name }}'|grep -Eo '[0-9]+.[0-9]+.[0-9]+')`" >> $GITHUB_OUTPUT
echo "PREVIOUS_VERSION=`echo $(git tag --list --sort=version:refname | grep -E '^[0-9]+.[0-9]+.[0-9]+$' | tail -n1)`" >> $GITHUB_OUTPUT
echo "AUTHOR=`echo $(git log -1 --pretty=%an)`" >> $GITHUB_OUTPUT
- name: Get git-chglog and update CHANGELOG
run: |
wget ${{ env.CHGLOG_PATH }}/${{ env.CHGLOG_RELEASE}}.tar.gz # get the binary for the chglog
tar --extract --file=${{ env.CHGLOG_RELEASE}}.tar.gz git-chglog
# update the changelog only for this tag
./git-chglog --tag-filter-pattern="[0-9]+.[0-9]+.[0-9]+${{ '$' }}|${{ github.ref_name}}" -o _tmpCHLOG.md ${{ github.ref_name }}
cat _tmpCHLOG.md CHANGELOG.md > new_CHLOG.md && mv new_CHLOG.md CHANGELOG.md
# now we substitute the clean tag
sed -i -e "s/${{ github.ref_name }}/${{ steps.release_version.outputs.version}}/g" CHANGELOG.md
rm git-chglog
- name: Update status badges in the readme file
run: |
# updated the branch parameter for all badges
sed -i -e "s/?branch=release-[0-9]\+.[0-9]\.[0-9]\+/?branch=release-${{ steps.release_version.outputs.version}}/g" README.md
- name: Update status badges in the readme file
run: |
# updated the branch parameter for all badges
sed -i -e "s/?branch=release-[0-9]\+.[0-9]\.[0-9]\+/?branch=release-${{ steps.release_version.outputs.version}}/g" README.md
- name: Create version release Pull Request
uses: peter-evans/create-pull-request@v6
with:
branch: release-${{ steps.release_version.outputs.version }}
commit-message: "Version ${{ steps.release_version.outputs.version }}"
token: ${{ secrets.GITHUB_TOKEN }}
add-paths: |
CHANGELOG.md
delete-branch: true # NOTE: No immediate delete after merge, instead branches with no diff are deleted
title: Release version ${{ steps.release_version.outputs.version }}
body: |
This request was triggered by **${{ steps.release_version.outputs.AUTHOR }}**
The initiating tag was **${{ github.ref_name }}**
- name: Create version release Pull Request
uses: peter-evans/create-pull-request@v6
with:
branch: release-${{ steps.release_version.outputs.version }}
commit-message: "Version ${{ steps.release_version.outputs.version }}"
token: ${{ secrets.GITHUB_TOKEN }}
add-paths: |
CHANGELOG.md
delete-branch: true # NOTE: No immediate delete after merge, instead branches with no diff are deleted
title: Release version ${{ steps.release_version.outputs.version }}
body: |
This request was triggered by **${{ steps.release_version.outputs.AUTHOR }}**
The initiating tag was **${{ github.ref_name }}**
Merging this Pull Request will create a release of the version **${{ steps.release_version.outputs.version }}**.
labels: |
version-release
base: main # NOTE: this should match the branch on which the tag was made
# draft: true # NOTE: this is not allowed on free private repos
Merging this Pull Request will create a release of the version **${{ steps.release_version.outputs.version }}**.
labels: |
version-release
base: main # NOTE: this should match the branch on which the tag was made
# draft: true # NOTE: this is not allowed on free private repos

0 comments on commit 4c8799d

Please sign in to comment.