diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 620172b..d6da661 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -1,8 +1,10 @@ name: Semantic Release and Publish -# Trigger only when release branch gets new commits (PR merge) +# Trigger only when PR from main to release is merged on: - push: + pull_request: + types: + - closed branches: - release @@ -10,18 +12,20 @@ jobs: release: name: Release runs-on: ubuntu-latest + # Only run if PR was merged (not just closed) + if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'release' && github.event.pull_request.head.ref == 'main' - # Needed permissions for tags, releases, etc. permissions: contents: write issues: write pull-requests: write steps: - # 1️⃣ Checkout full repo including history and tags + # 1️⃣ Checkout repository with full history and tags - name: Checkout repository uses: actions/checkout@v4 with: + ref: release fetch-depth: 0 # 2️⃣ Setup Node.js @@ -33,7 +37,10 @@ jobs: # 3️⃣ Install dependencies - name: Install dependencies - run: npm ci + run: | + npm ci + # 🔑 Ensure all semantic-release plugins are installed + npm install --save-dev @semantic-release/git @semantic-release/npm @semantic-release/github @semantic-release/release-notes-generator @semantic-release/commit-analyzer # 4️⃣ Run tests - name: Run tests diff --git a/.releaserc.json b/.releaserc.json index 4633162..1a17396 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -1,19 +1,16 @@ { - "branches": ["release"], + "branches": ["main"], "tagFormat": "v${version}", "plugins": [ "@semantic-release/commit-analyzer", "@semantic-release/release-notes-generator", - ["@semantic-release/npm", { "npmPublish": true }], - ["@semantic-release/git", { "assets": ["package.json"], "message": "chore(release): ${nextRelease.version} [skip ci]" }], - "@semantic-release/github" ] -} \ No newline at end of file +} diff --git a/package-lock.json b/package-lock.json index 62289ee..b462f3b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-chef", - "version": "0.2.0", + "version": "0.2.1", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/package.json b/package.json index e4e3206..ca3e1c2 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,13 @@ { "name": "react-chef", - "version": "0.2.0", + "version": "0.3.0", "private": false, "publishConfig": { "access": "public" }, "description": "Transparent React Boilerplate Apps", "main": "index.js", - "repository": { - "type": "git", - "url": "git+https://github.com/web-slate/react-chef.git" - }, + "repository": "web-slate/react-chef", "engine": { "node": "10", "npm": "5" @@ -37,5 +34,13 @@ "commander": "^7.1.0", "inquirer": "^8.0.0", "shelljs": "^0.8.4" + }, + "devDependencies": { + "semantic-release": "^22.0.12", + "@semantic-release/git": "^10.0.1", + "@semantic-release/github": "^9.2.6", + "@semantic-release/npm": "^11.0.2", + "@semantic-release/commit-analyzer": "^11.1.0", + "@semantic-release/release-notes-generator": "^12.1.0" } }