jpoehnelt/semantic-release-replace-plugin

Match not found semantic-release-replace-plugin

adnan-ashfaq opened this issue · 1 comments

Hey, I am running semantic release, however it's ending up with the following.

config

plugins:
  - - "@semantic-release/commit-analyzer"
    - preset: conventionalcommits
  - - "@semantic-release/release-notes-generator"
    - preset: conventionalcommits
  - - "semantic-release-replace-plugin"
    - replacements:
        - files:
            - gradle.properties
          from: "version\\s*=\\s*.*"
          to: "version=${nextRelease.version}"
          results:
            - file: gradle.properties
              hasChanged: true
              numMatches: 1
              numReplacements: 1
          countMatches: true
  - - "@semantic-release/changelog"
    - changelogFile: "CHANGELOG.md"
      changelogTitle: "# Changelog"
  - - "@semantic-release/git"
    - assets:
        - gradle.properties
        - CHANGELOG.md
      message: "chore(*): Release ${nextRelease.version}\n\n${nextRelease.notes}"
  - "@semantic-release/github"

branches:
  - name: "main"

tagFormat: "${version}"

github action

name: Release
on:
  push:
    branches:
      - main
  workflow_dispatch:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: false

jobs:
  release:
    name: Make Release
    runs-on: ubuntu-latest
    steps:
      - name: 'Checkout Repository'
        uses: actions/checkout@v4
        with:
          fetch-depth: '0'
          persist-credentials: true
          ssh-key: "${{ secrets.SSH_KEY_GITHUB }}"
      - uses: tech/gh-action-install-angular-app@v3
        with:
          username: '${{ vars.ARTIFACTORY_IDENTITY_TOKEN_USER }}'
          password: "${{ secrets.ARTIFACTORY_IDENTITY_TOKEN }}"
      - name: Release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: npx semantic-release

Error

Start step "prepare" of plugin "semantic-release-replace-plugin"
[12:52:49 PM] [semantic-release] › ✘  Failed step "prepare" of plugin "semantic-release-replace-plugin"
[12:52:49 PM] [semantic-release] › ✘  An error occurred while running semantic-release: Error: Expected match not found!
- Expected
+ Received

  Array [
    Object {
      "file": "gradle.properties",
-     "hasChanged": false,
+     "hasChanged": true,
      "numMatches": 1,
-     "numReplacements": 0,
+     "numReplacements": 1,
    },
  ]
    at prepare (file:///home/runner/work/medeo-patient-management-api/medeo-patient-management-api/node_modules/semantic-release-replace-plugin/dist/index.js:80:23)
    at async validator (file:///home/runner/work/medeo-patient-management-api/medeo-patient-management-api/node_modules/semantic-release/lib/plugins/normalize.js:36:24)
    at async file:///home/runner/work/medeo-patient-management-api/medeo-patient-management-api/node_modules/semantic-release/lib/plugins/pipeline.js:38:36
    at async Promise.all (index 0)
    at async next (file:///home/runner/work/medeo-patient-management-api/medeo-patient-management-api/node_modules/p-reduce/index.js:15:44) {
  pluginName: 'semantic-release-replace-plugin'
}
Error: Expected match not found!
- Expected
+ Received

  Array [
    Object {
      "file": "gradle.properties",
-     "hasChanged": false,
+     "hasChanged": true,
      "numMatches": 1,
-     "numReplacements": 0,
+     "numReplacements": 1,
    },
  ]
    at prepare (file:///home/runner/work/medeo-patient-management-api/medeo-patient-management-api/node_modules/semantic-release-replace-plugin/dist/index.js:[80](https://github.com/qhrtech/medeo-patient-management-api/actions/runs/9096006877/job/25000460330#step:4:81):23)
    at async validator (file:///home/runner/work/medeo-patient-management-api/medeo-patient-management-api/node_modules/semantic-release/lib/plugins/normalize.js:36:24)
    at async file:///home/runner/work/medeo-patient-management-api/medeo-patient-management-api/node_modules/semantic-release/lib/plugins/pipeline.js:38:36
    at async Promise.all (index 0)
    at async next (file:///home/runner/work/medeo-patient-management-api/medeo-patient-management-api/node_modules/p-reduce/index.js:15:44) {
  pluginName: 'semantic-release-replace-plugin'
}
Error: Process completed with exit code 1.

Nevermind. Figured it out. the version number in my gradle.properties was already on 1.1.0 and when running release, it couldn't find any difference hence the error.