Why scemantic-release fails to tag my lib and release it?

33 Views Asked by At

I am developing a library and for that I am setting up a CI pipeline using github actions:


name: "release-sass"  

on:
  push:
    branches:
      - dev

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
        - name: Checkout current branch
          uses: actions/checkout@v4

        - name: "Setup Node"
          uses: actions/setup-node@v4
          with:
              node-version: 21
        - name: "Install npm dependencies"
          run: npm install
        - name: "Building SASS files"
          run: npm run sass

        - name: commit built sass
          uses: actions-x/commit@v6
          with:
            email: [email protected]
            name: Autocommiting Built CSS
            files: ./dist/*
            token: ${{ secrets.MY_SECRET_TOKEN }}
            force: true

        - name: Install jq
          run: sudo apt-get install jq

        - name: Set up Git Config
          run: |
            git config user.email "[email protected]"
            git config user.name "GitHub Actions"

        - name: Run Semantic Release
          id: release
          env:
            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          run: |
            RELEASE_VERSION=$(npx semantic-release -d)
            echo "release_version=${RELEASE_VERSION}" >> $GITHUB_ENV

        - name: Extract Release Version
          run: echo "::set-output name=release_version::$(echo $RELEASE_VERSION | jq -r '.nextRelease.version')"

        # - name: Create a GitHub release
        #   if: github.ref == 'refs/heads/master'
        #   id: create_release
        #   uses: actions/create-release@v1
        #   env:
        #     GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        #   with:
        #     tag_name: ${{ steps.release_tag.outputs.versionNum }}
        #     release_name: Release of SASS ${{ steps.get_version.outputs.versionNum }}
        #     body: ${{ steps.tag_version.outputs.changelog }}

And what I try to do is to use the scemantic-release in order to create the release and the tag of my lib:

package.json

{
  "name": "fa-checkbox",
  "version": "1.0.0",
  "description": "Checkbox Css and SASS",
  "main": "index.html",
  "scripts": {
    "start": "npm-run-all --parallel watch-css start-server",
    "watch-css": "sass --watch scss:dev",
    "start-server": "live-server",
    "sass": " sass scss:dist"
  },
  "keywords": [
    "css",
    "checkbox",
    "fontawesome"
  ],
  "author": "Cypriot Free Software Foundation",
  "license": "MIT",
  "devDependencies": {
    "live-server": "^1.2.2",
    "npm-run-all": "^4.1.5",
    "sass": "^1.69.7",
    "semantic-release": "^23.0.0"
  }
}

release.config.js

module.exports = {
  branches: ['dev'],
  plugins: [
    '@semantic-release/commit-analyzer',
    '@semantic-release/release-notes-generator',
    '@semantic-release/github',
  ],
};

But I get the following error:

Error: Unable to process file command 'env' successfully.
Error: Invalid format '[9:01:30 PM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/github"'

And I have no idea what is misconfigured, can you help me?

I tried changing the release step into:

        - name: Run Semantic Release
          id: release
          env:
            GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          run: |
            RELEASE_VERSION=$(npx semantic-release -d)
            echo "release_version=${RELEASE_VERSION}" >> $GITHUB_ENV

But the error persists.

0

There are 0 best solutions below