refactor(publish-dev): take ref instead (#11236)

* refactor(publish-dev): take ref instead

* fix: main checks

* chore: relevant examples

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Denis-Adrian Cristea
2025-11-10 16:39:42 +02:00
committed by GitHub
parent c85f18c1ee
commit 37a38883d7

View File

@@ -4,8 +4,8 @@ on:
- cron: '0 */12 * * *' - cron: '0 */12 * * *'
workflow_dispatch: workflow_dispatch:
inputs: inputs:
pull: ref:
description: 'The pull number to check out' description: 'The ref to check out. e.g. main, feat/new-feature, refs/pull/1234/head'
required: false required: false
default: 'main' default: 'main'
tag: tag:
@@ -33,21 +33,12 @@ jobs:
app-id: ${{ vars.DISCORDJS_APP_ID }} app-id: ${{ vars.DISCORDJS_APP_ID }}
private-key: ${{ secrets.DISCORDJS_APP_KEY_RELEASE }} private-key: ${{ secrets.DISCORDJS_APP_KEY_RELEASE }}
- name: Decide ref
id: ref
run: |
if [ -n "${{ github.event.inputs.pull }}" ]; then
echo "ref=refs/pull/${{ github.event.inputs.pull }}/head" >> $GITHUB_OUTPUT
else
echo "ref=refs/heads/main" >> $GITHUB_OUTPUT
fi
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v5 uses: actions/checkout@v5
with: with:
fetch-depth: 0 fetch-depth: 0
token: ${{ steps.app-token.outputs.token }} token: ${{ steps.app-token.outputs.token }}
ref: ${{ steps.ref.outputs.ref }} ref: ${{ inputs.ref }}
- name: Install Node.js v24 - name: Install Node.js v24
uses: actions/setup-node@v6 uses: actions/setup-node@v6
@@ -63,13 +54,13 @@ jobs:
run: pnpm run build run: pnpm run build
- name: Checkout main repository (non-main ref) - name: Checkout main repository (non-main ref)
if: ${{ steps.ref.outputs.ref != 'refs/heads/main' }} if: ${{ inputs.ref != 'main' }}
uses: actions/checkout@v5 uses: actions/checkout@v5
with: with:
path: 'main' path: 'main'
- name: Install action deps (non-main ref) - name: Install action deps (non-main ref)
if: ${{ steps.ref.outputs.ref != 'refs/heads/main' }} if: ${{ inputs.ref != 'main' }}
shell: bash shell: bash
working-directory: ./main working-directory: ./main
env: env:
@@ -79,7 +70,7 @@ jobs:
pnpm install --filter @discordjs/actions --frozen-lockfile --prefer-offline --loglevel error pnpm install --filter @discordjs/actions --frozen-lockfile --prefer-offline --loglevel error
- name: Publish packages (non-main ref) - name: Publish packages (non-main ref)
if: ${{ steps.ref.outputs.ref != 'refs/heads/main' }} if: ${{ inputs.ref != 'main' }}
uses: ./main/packages/actions/src/releasePackages uses: ./main/packages/actions/src/releasePackages
with: with:
exclude: '@discordjs/docgen' exclude: '@discordjs/docgen'
@@ -91,7 +82,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish packages (main ref) - name: Publish packages (main ref)
if: ${{ steps.ref.outputs.ref == 'refs/heads/main' }} if: ${{ inputs.ref == 'main' }}
uses: ./packages/actions/src/releasePackages uses: ./packages/actions/src/releasePackages
with: with:
exclude: '@discordjs/docgen' exclude: '@discordjs/docgen'