From f0c32f6a672f4da18f47e0101fbc1b308b076f30 Mon Sep 17 00:00:00 2001 From: Digikwal <79085106+digikwal@users.noreply.github.com> Date: Tue, 24 Jun 2025 19:56:42 +0200 Subject: [PATCH] ci: Merge workflows: Pre-commit and Lint into Semantic Release - Combined the `Pre-commit` and `Lint` workflows under the `on.workflow_run` trigger in the Semantic Release workflow. - Unified steps for dependency installation, testing, and release note generation. - Added handling for `FRAPPE_BRANCH` to ensure metadata files are created and uploaded consistently. - Reduced redundancy and improved maintainability of the workflow configuration. --- .github/workflows/semantic-release.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/semantic-release.yml b/.github/workflows/semantic-release.yml index 7b88ce02..bca86d54 100644 --- a/.github/workflows/semantic-release.yml +++ b/.github/workflows/semantic-release.yml @@ -3,7 +3,7 @@ name: Semantic Release on: workflow_run: workflows: - - Lint + - Pre-commit types: - completed @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout repo + - name: Checkout repository uses: actions/checkout@v3 - name: Set up Node.js @@ -33,19 +33,23 @@ jobs: - name: Run tests run: npm test + - name: Install conventional changelog + run: | + npm install --save-dev conventional-changelog-conventionalcommits + - name: Generate release notes and version id: semantic_release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | RELEASE_TAG=$(npx semantic-release | tee /dev/stderr | grep -oP '(?<=next release version is )[^ ]+') - echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV + echo "RELEASE_TAG=${RELEASE_TAG}" >> $GITHUB_ENV - name: Create release metadata files run: | # Determine FRAPPE_BRANCH if not already set FRAPPE_BRANCH=${{ vars.FRAPPE_BRANCH || 'version-15' }} - echo "FRAPPE_BRANCH=$FRAPPE_BRANCH" >> $GITHUB_ENV + echo "FRAPPE_BRANCH=${FRAPPE_BRANCH}" >> $GITHUB_ENV # Save metadata to files echo "${RELEASE_TAG}" > release_tag.txt