Merge pull request #36 from reecetech/fix-lint

Fix lint & create new release
This commit is contained in:
Phil Jay
2024-09-02 08:02:15 +10:00
committed by GitHub
2 changed files with 10 additions and 6 deletions

View File

@@ -78,7 +78,7 @@ jobs:
- macos-latest - macos-latest
- ubuntu-latest - ubuntu-latest
- windows-latest - windows-latest
fail-fast: true fail-fast: false
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Checkout code # have to checkout to have the source code available - name: Checkout code # have to checkout to have the source code available
@@ -126,8 +126,11 @@ jobs:
shell: bash shell: bash
run: | run: |
[[ "${{ steps.version-prefix.outputs.current-version }}" == "0.0.0" ]] [[ "${{ steps.version-prefix.outputs.current-version }}" == "0.0.0" ]]
[[ "${{ steps.version-prefix.outputs.version }}" == "0.0.1" ]] [[ "${{ steps.version-prefix.outputs.major-version }}" == "0" ]]
[[ "${{ steps.version-prefix.outputs.prefixed-version }}" == "foo/bar@0.0.1" ]] [[ "${{ steps.version-prefix.outputs.minor-version }}" == "0" ]]
[[ "${{ steps.version-prefix.outputs.patch-version }}" == "1" ]]
[[ "${{ steps.version-prefix.outputs.version }}" = "0.0.1-"* ]]
[[ "${{ steps.version-prefix.outputs.prefixed-version }}" = "foo/bar@0.0.1-"* ]]
release: release:
needs: needs:

View File

@@ -22,14 +22,15 @@ remove_prefix() {
if [[ -n "${tag_prefix:-}" ]]; then if [[ -n "${tag_prefix:-}" ]]; then
# Escape special characters in tag_prefix # Escape special characters in tag_prefix
local escaped_prefix local escaped_prefix
escaped_prefix=$(printf '%s\n' "$tag_prefix" | sed 's/[][\/.^$*]/\\&/g') escaped_prefix=$(printf '%s\n' "$tag_prefix" | sed 's/[][\/.^$*]/\\&/g') # special chars matched by sed: ] [ / . ^ $ *
# shellcheck disable=SC2143
if [[ -z "$(echo "${tag}" | grep "^${tag_prefix}")" ]] ; then if [[ -z "$(echo "${tag}" | grep "^${tag_prefix}")" ]] ; then
echo "" echo ""
return return
fi fi
# Use | as the delimiter to avoid conflicts with / # shellcheck disable=SC2001
echo "${tag}" | sed "s|^${escaped_prefix}||" echo "${tag}" | sed "s|^${escaped_prefix}||" # Use | as the delimiter to avoid conflicts with /
else else
echo "${tag}" echo "${tag}"
fi fi