🏡 index : quine-global/webdriverio.git

name: Manual NPM Publish

on:
  workflow_dispatch:
    inputs:
      releaseType:
        description: "Release Type"
        required: true
        type: choice
        default: "patch"
        options:
          - patch
          - minor
          - major
          - premajor
      distTag:
        description: 'NPM tag (e.g. use "next --canary" to release a test version, add "--force-publish" to release all packages)'
        required: true
        default: 'latest'

env:
  NPM_TOKEN: ${{secrets.NPM_TOKEN}}
  # disable provenance check as it stopped working with Lerna:
  #   > lerna ERR! E422 Error verifying sigstore provenance bundle: Failed to validate the provenance
  #   > subject against the package name, version and tarball integrity. Please try re-publishing with
  #   > the latest stable version of npm
  # NPM_CONFIG_PROVENANCE: true

jobs:
  authorize:
    name: Authorize Actor
    uses: ./.github/workflows/authorize.yml
    secrets: inherit
  release:
    permissions:
      contents: write
      id-token: write
      packages: read
    needs: [authorize]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
        with:
          ref: 'main'
          fetch-depth: 0
      - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
      - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
        with:
          node-version-file: '.nvmrc'
          cache: 'pnpm'
      - name: NPM Setup
        run: |
          npm set registry "https://registry.npmjs.org/"
          npm set //registry.npmjs.org/:_authToken $NPM_TOKEN
          npm whoami
      - name: Git Setup
        run: |
          git config --global user.email "bot@webdriver.io"
          git config --global user.name "WebdriverIO Release Bot"
      - name: Install Dependencies
        run: pnpm install
      - name: Release
        run: |
          pnpm run setup
          pnpm -r --filter=@wdio/lerna-patch run patch
          pnpm lerna publish ${{github.event.inputs.releaseType}} --exact --yes --dist-tag ${{github.event.inputs.distTag}}
          pnpm run pushReleaseTag
        env:
          NODE_ENV: production
          GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}