Skip to content

bump: version 0.1.0 → 0.1.1 (#1) #8

bump: version 0.1.0 → 0.1.1 (#1)

bump: version 0.1.0 → 0.1.1 (#1) #8

Workflow file for this run

name: Release Test Checks
on:
push:
branches:
- release-test
jobs:
build-release:
name: Build a release for the module
runs-on: ubuntu-latest
if: ${{ !startsWith(github.event.head_commit.message, 'bump:') }}
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Bump version and create changelog
id: bump
uses: commitizen-tools/commitizen-action@master
with:
push: false
github_token: ${{ secrets.GITHUB_TOKEN }}
changelog_increment_filename: release.md
git_redirect_stderr: true
- name: Output the new version number
run: echo '${{ steps.bump.outputs.version }}'
- name: Get the module name
id: module_name
run: |
REPO_NAME="${{ github.event.repository.name }}"
REPO_NAME="${REPO_NAME/tofu-modules-/}"
MODULE_NAME="${REPO_NAME//-/_}"
echo "name=${MODULE_NAME}" >> $GITHUB_OUTPUT
- name: Output the module name
run: echo '${{ steps.module_name.outputs.name }}'
- name: Get the commit message
id: message
run: |
MESSAGE=$(git log --format=%B -n 1)
echo "message=${MESSAGE}" >> $GITHUB_OUTPUT
- name: Open a pull request for the release
uses: peter-evans/create-pull-request@v7
with:
branch: release-${{ steps.bump.outputs.version }}
title: ${{ steps.message.outputs.message }}
release:
name: Build a release for the module
runs-on: ubuntu-latest
if: startsWith(github.event.head_commit.message, 'bump:')
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Print commit message
run: echo '${{ github.event.head_commit.message }}'
- name: Determine the new version number
id: version
shell: bash
# Look for the last version number, expecting it to be in the format:
# `#.#.#-<suffix>.#` where the suffix is optional.
run: |
MESSAGE='${{ github.event.head_commit.message }}'
[[ $MESSAGE =~ ^bump:.+([0-9]+\.[0-9+]\.[0-9]+[a-z0-9.\-]*)[[:space:]]\\(#[0-9]+\\) ]]
echo "version=${BASH_REMATCH[2]}" >> $GITHUB_OUTPUT
- name: Output the new version number
run: echo '${{ steps.version.outputs.version }}'