diff --git a/.github/workflows/publish-npm-packages.yml b/.github/workflows/publish-npm-packages.yml index dd1f188e0ae2f..52a6d8f9833f2 100644 --- a/.github/workflows/publish-npm-packages.yml +++ b/.github/workflows/publish-npm-packages.yml @@ -30,12 +30,14 @@ jobs: environment: WordPress packages steps: - name: Checkout (for CLI) + if: ${{ github.event.inputs.release_type != 'wp' }} uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 with: path: cli ref: trunk - name: Checkout (for publishing) + if: ${{ github.event.inputs.release_type != 'wp' }} uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 with: path: publish @@ -43,6 +45,14 @@ jobs: ref: trunk token: ${{ secrets.GUTENBERG_TOKEN }} + - name: Checkout (for publishing WP major version) + if: ${{ github.event.inputs.release_type == 'wp' && github.event.inputs.wp_version }} + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + with: + path: publish + ref: wp/${{ github.event.inputs.wp_version }} + token: ${{ secrets.GUTENBERG_TOKEN }} + - name: Configure git user name and email (for publishing) run: | cd publish @@ -50,11 +60,19 @@ jobs: git config user.email gutenberg@wordpress.org - name: Setup Node.js + if: ${{ github.event.inputs.release_type != 'wp' }} uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 with: node-version-file: 'cli/.nvmrc' registry-url: 'https://registry.npmjs.org' + - name: Setup Node.js (for WP major version) + if: ${{ github.event.inputs.release_type == 'wp' && github.event.inputs.wp_version }} + uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 + with: + node-version-file: 'publish/.nvmrc' + registry-url: 'https://registry.npmjs.org' + - name: Publish development packages to npm ("next" dist-tag) if: ${{ github.event.inputs.release_type == 'development' }} run: | @@ -73,7 +91,7 @@ jobs: env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - name: Publish packages to npm for WP major ("wp/${{ github.event.inputs.wp_version || 'X.Y' }}" dist-tag) + - name: Publish packages to npm for WP major version ("wp/${{ github.event.inputs.wp_version || 'X.Y' }}" dist-tag) if: ${{ github.event.inputs.release_type == 'wp' && github.event.inputs.wp_version }} run: | cd publish