Skip to content

Commit

Permalink
fix: externalize powershell to module (#23)
Browse files Browse the repository at this point in the history
* chore: normalize actions

* fix: use ConventionalVersioning module
  • Loading branch information
ArwynFr committed Sep 11, 2023
1 parent b587aa3 commit 0bc3e42
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 143 deletions.
44 changes: 20 additions & 24 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,65 +1,61 @@
name: 'Conventional Versioning: new release'
description: 'Create Github Release using SemVer when pushing Conventional Comits'
name: "Conventional Versioning: new release"
description: "Create Github Release using SemVer when pushing Conventional Comits"
author: ArwynFr
branding:
icon: tag
color: blue

inputs:

pattern:
description: 'Pattern of files to include in the release'
description: "Pattern of files to include in the release"
required: false

allow-additional-modifiers:
description: 'Whether this action supports additional modifiers and footers for minor and patch updates.'
description: "Whether this action supports additional modifiers and footers for minor and patch updates."
required: false
default: 'false'
default: "false"

feat-upgrades-minor:
description: 'Whether this action should increment a minor bump when the commit type is feat.'
description: "Whether this action should increment a minor bump when the commit type is feat."
required: false
default: 'true'
default: "true"

strict-types:
description: 'Whether this action should fail if the commit type is a custom type.'
description: "Whether this action should fail if the commit type is a custom type."
required: false
default: 'false'
default: "false"

outputs:

current-version:
description: 'Current release version number found in the repository'
description: "Current release version number found in the repository"
value: ${{ steps.new-github-release.outputs.current-version }}

bump-type:
description: 'Type of version bump based on commit message'
description: "Type of version bump based on commit message"
value: ${{ steps.new-github-release.outputs.bump-type }}

next-version:
description: 'Calculated target version of the new release'
description: "Calculated target version of the new release"
value: ${{ steps.new-github-release.outputs.next-version }}

runs:
using: "composite"
steps:

- shell: pwsh
- uses: arwynfr/actions-conventional-versioning/get-newVersion@v3
id: new-github-release
env:
GH_TOKEN: ${{ github.token }}
run: |
& "${env:GITHUB_ACTION_PATH}/functions/Get-NewVersion.ps1" `
-RepositoryName "${{ github.repository }}" `
-CommitMessage "${{ github.event.head_commit.message }}" `
-FeatUpgradesMinor:$${{ inputs.feat-upgrades-minor }} `
-AllowAdditionalModifiers:$${{ inputs.allow-additional-modifiers }}
with:
allow-additional-modifiers: ${{ inputs.allow-additional-modifiers }}
feat-upgrades-minor: ${{ inputs.feat-upgrades-minor }}
strict-types: ${{ inputs.strict-types }}

- shell: pwsh
name: Publish a new release on Github
env:
GH_TOKEN: ${{ github.token }}
run: |
& "${env:GITHUB_ACTION_PATH}/functions/New-GithubRelease.ps1" `
-RepositoryName "${{ github.repository }}" `
New-GithubRelease `
-Pattern "${{ inputs.pattern }}" `
-RepositoryName "${{ github.repository }}" `
-NextVersion ${{ steps.new-github-release.outputs.next-version }}
13 changes: 0 additions & 13 deletions functions/Get-CurrentVersion.ps1

This file was deleted.

41 changes: 0 additions & 41 deletions functions/Get-NewVersion.ps1

This file was deleted.

30 changes: 0 additions & 30 deletions functions/Get-VersionBumpType.ps1

This file was deleted.

21 changes: 0 additions & 21 deletions functions/New-GithubRelease.ps1

This file was deleted.

32 changes: 18 additions & 14 deletions get-newVersion/action.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,55 @@
name: 'Conventional Versioning: get new version'
description: 'Provides the new SemVer version based on Conventional Comits'
name: "Conventional Versioning: get new version"
description: "Provides the new SemVer version based on Conventional Comits"
author: ArwynFr
branding:
icon: tag
color: blue

inputs:

allow-additional-modifiers:
description: 'Whether this action supports additional modifiers and footers for minor and patch updates.'
description: "Whether this action supports additional modifiers and footers for minor and patch updates."
required: false
default: 'false'
default: "false"

feat-upgrades-minor:
description: 'Whether this action should increment a minor bump when the commit type is feat.'
description: "Whether this action should increment a minor bump when the commit type is feat."
required: false
default: 'true'
default: "true"

strict-types:
description: 'Whether this action should fail if the commit type is a custom type.'
description: "Whether this action should fail if the commit type is a custom type."
required: false
default: 'false'
default: "false"

outputs:

current-version:
description: 'Current release version number found in the repository'
description: "Current release version number found in the repository"
value: ${{ steps.new-github-release.outputs.current-version }}

bump-type:
description: 'Type of version bump based on commit message'
description: "Type of version bump based on commit message"
value: ${{ steps.new-github-release.outputs.bump-type }}

next-version:
description: 'Calculated target version of the new release'
description: "Calculated target version of the new release"
value: ${{ steps.new-github-release.outputs.next-version }}

runs:
using: "composite"
steps:
- shell: pwsh
name: Install Powershell module ConventionalVersioning
run: |
Install-Module -Force ConventionalVersioning
Import-Module -Force ConventionalVersioning
- shell: pwsh
name: Calculate new version for the repository
id: new-github-release
env:
GH_TOKEN: ${{ github.token }}
run: |
& "${env:GITHUB_ACTION_PATH}/../functions/Get-NewVersion.ps1" `
New-RepositoryVersion `
-RepositoryName "${{ github.repository }}" `
-CommitMessage "${{ github.event.head_commit.message }}" `
-FeatUpgradesMinor:$${{ inputs.feat-upgrades-minor }} `
Expand Down

0 comments on commit 0bc3e42

Please sign in to comment.