Skip to content

chore: Bump version to 1.5.0 #22

chore: Bump version to 1.5.0

chore: Bump version to 1.5.0 #22

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
- '!v[0-9]'
jobs:
create_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Conventional Commit Changelog
id: conventional_commits
shell: bash
run: |
curl -s -L -o./clog.tar.gz https://github.com/clog-tool/clog-cli/releases/download/v0.9.3/clog-v0.9.3-x86_64-unknown-linux-musl.tar.gz
tar -xf ./clog.tar.gz
chmod +x ./clog
# delete current tag locally
git tag -d "$GITHUB_REF_NAME"
if [[ "$GITHUB_REF_NAME" == *"-"* ]]; then
last_tag="$(git tag -l --sort version:refname | tail -n1)"
else
last_tag="$(git tag -l --sort version:refname | grep -v -- - | tail -n1)"
fi
printf 'Using %s as last tag\n' "$last_tag"
echo 'CHANGELOG<<EOF' >> $GITHUB_ENV
./clog --from="$last_tag" --setversion="$GITHUB_REF_NAME" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Determine release type
id: release_type
shell: bash
run: |
[[ "$GITHUB_REF_NAME" == *"-"* ]] && is_pre='true' || is_pre='false'
printf '%s=%s\n' 'is_pre' "$is_pre" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
draft: ${{ steps.release_type.outputs.is_pre }}
prerelease: ${{ steps.release_type.outputs.is_pre }}
body: ${{ env.CHANGELOG }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Update major version tag
if: ${{ steps.release_type.outputs.is_pre == 'false' }}
shell: bash
run: |
major_tag="$(printf '%s' "$GITHUB_REF_NAME" | cut -d '.' -f 1)"
if git show "$major_tag" 2>&1 >/dev/null; then
git push origin --delete "$major_tag"
git tag -d "$major_tag"
fi
git tag "$major_tag"
git push --tags