qiwi / semantic-release-gh-pages-plugin

github-pages publishing plugin for semantic-release
MIT License
23 stars 8 forks source link

Problem setting up src-to-dst branch pairing #248

Closed rb-mwindh closed 11 months ago

rb-mwindh commented 11 months ago

Issue type

Expected behavior

I'm setting up the semantic-release workflow for my npm library.

I want to use the following destination branches for my gh-pages:

"branches": [
  ["main", "gh-pages"],
  ["alpha", "gh-pages-alpha"],
  ["beta", "gh-pages-beta"]
]

Actual behavior

The semantic-release-gh-pages-plugin resolves the wrong docsBranch (gh-pages), although the ciBranch is correctly determined as alpha.

GitHub Action Log

[9:17:47 AM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@qiwi/semantic-release-gh-pages-plugin"
2023-10-18T09:17:47.203Z semantic-release:gh-pages getRepoUrl:
2023-10-18T09:17:47.203Z semantic-release:gh-pages urlFromEnv= undefined
2023-10-18T09:17:47.203Z semantic-release:gh-pages urlFromStepOpts= https://github.some-enterprise.com/some-org/some-repo.git
2023-10-18T09:17:47.203Z semantic-release:gh-pages urlFromOpts= https://github.some-enterprise.com/some-org/some-repo.git
2023-10-18T09:17:47.203Z semantic-release:gh-pages urlFromPackage= https://github.some-enterprise.com/some-org/some-repo.git
2023-10-18T09:17:47.204Z semantic-release:gh-pages resolveConfig args:
2023-10-18T09:17:47.204Z semantic-release:gh-pages pluginConfig= {"branches":[["main","gh-pages"],["alpha","gh-pages-alpha"],["beta","gh-pages-beta"]],"repositoryUrl":"https://github.some-enterprise.com/some-org/some-repo.git","tagFormat":"v${version}","_":[],"debug":true,"$0":"node_modules/.bin/semantic-release","enterprise":true}
2023-10-18T09:17:47.205Z semantic-release:gh-pages path= @qiwi/semantic-release-gh-pages-plugin
2023-10-18T09:17:47.205Z semantic-release:gh-pages step= publish
2023-10-18T09:17:47.205Z semantic-release:gh-pages ciBranch= alpha
2023-10-18T09:17:47.205Z semantic-release:gh-pages docsBranch= gh-pages
2023-10-18T09:17:47.205Z semantic-release:gh-pages pullTagsBranch= alpha
[9:17:47 AM] [semantic-release] [@qiwi/semantic-release-gh-pages-plugin] › ℹ  verify gh-pages config
[9:17:47 AM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@qiwi/semantic-release-gh-pages-plugin"
...
[9:18:17 AM] [semantic-release] › ℹ  Start step "publish" of plugin "@qiwi/semantic-release-gh-pages-plugin"
2023-10-18T09:18:17.003Z semantic-release:gh-pages getRepoUrl:
2023-10-18T09:18:17.003Z semantic-release:gh-pages urlFromEnv= undefined
2023-10-18T09:18:17.004Z semantic-release:gh-pages urlFromStepOpts= https://github.some-enterprise.com/some-org/some-repo.git
2023-10-18T09:18:17.004Z semantic-release:gh-pages urlFromOpts= https://github.some-enterprise.com/some-org/some-repo.git
2023-10-18T09:18:17.004Z semantic-release:gh-pages urlFromPackage= https://github.some-enterprise.com/some-org/some-repo.git
2023-10-18T09:18:17.005Z semantic-release:gh-pages resolveConfig args:
2023-10-18T09:18:17.005Z semantic-release:gh-pages pluginConfig= {"branches":[["main","gh-pages"],["alpha","gh-pages-alpha"],["beta","gh-pages-beta"]],"repositoryUrl":"https://github.some-enterprise.com/some-org/some-repo.git","tagFormat":"v${version}","_":[],"debug":true,"$0":"node_modules/.bin/semantic-release","enterprise":true}
2023-10-18T09:18:17.006Z semantic-release:gh-pages path= @qiwi/semantic-release-gh-pages-plugin
2023-10-18T09:18:17.006Z semantic-release:gh-pages step= publish
2023-10-18T09:18:17.006Z semantic-release:gh-pages ciBranch= alpha
2023-10-18T09:18:17.006Z semantic-release:gh-pages docsBranch= gh-pages
2023-10-18T09:18:17.007Z semantic-release:gh-pages pullTagsBranch= alpha
[9:18:17 AM] [semantic-release] [@qiwi/semantic-release-gh-pages-plugin] › ℹ  Publishing docs via gh-pages
[9:18:30 AM] [semantic-release] [@qiwi/semantic-release-gh-pages-plugin] › ℹ  Docs published successfully, branch=gh-pages, src=docs, dst=.
[9:18:30 AM] [semantic-release] › ✔  Completed step "publish" of plugin "@qiwi/semantic-release-gh-pages-plugin"

Steps to reproduce

.github/workflows/release.yml

name: Release

on:
  push:
    branches:
      - main
      - alpha
      - beta
  workflow_dispatch:

jobs:
  release:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v3
        with:
          token: ${{ secrets.GH_TOKEN }}
          fetch-depth: 0

      - name: Setup Node.js
        uses: actions/setup-node@v3
        with:
          node-version: 16

      - name: Install dependencies
        run: npm ci

      - name: Run Semantic Release
        run: npm run semantic-release
        env:
          GH_TOKEN: ${{ secrets.GH_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

package.json

{
  ...
  "scripts": {
    "semantic-release": "semantic-release",
  },
  "devDependencies": {
    "@qiwi/semantic-release-gh-pages-plugin": "^5.2.8",
    "@semantic-release/changelog": "^6.0.3",
    "@semantic-release/git": "^10.0.1",
    "semantic-release": "^19.0.5",
  },
  "release": {
    "branches": [
      "main",
      { "name": "alpha", "prerelease": true },
      { "name": "beta", "prerelease": true }
    ],
    "plugins": [
      [ "@semantic-release/commit-analyzer" ],
      [ "@semantic-release/release-notes-generator", {
          "preset": "conventionalcommits"
      }],
      [ "@semantic-release/changelog" ],
      [ "@semantic-release/npm" ],
      [ "@semantic-release/github", {
          "assets": [ "*.tgz" ]
      }],
      [ "@qiwi/semantic-release-gh-pages-plugin", {
          "branches": [
            ["main", "gh-pages"],
            ["alpha", "gh-pages-alpha"],
            ["beta", "gh-pages-beta"]
          ],
          "enterprise": true
      }],
      [ "@semantic-release/git", {
          "assets": [
            "package.json",
            "package-lock.json",
            "CHANGELOG.md"
          ]
      }]
    ]
  }
}

Specifications

CI Platform

antongolub commented 11 months ago

Hey, @rb-mwindh,

Thanks for the report. The fix is on the way.