Skip to content

Commit 37a3888

Browse files
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>
1 parent c85f18c commit 37a3888

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

.github/workflows/publish-dev.yml

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ on:
44
- cron: '0 */12 * * *'
55
workflow_dispatch:
66
inputs:
7-
pull:
8-
description: 'The pull number to check out'
7+
ref:
8+
description: 'The ref to check out. e.g. main, feat/new-feature, refs/pull/1234/head'
99
required: false
1010
default: 'main'
1111
tag:
@@ -33,21 +33,12 @@ jobs:
3333
app-id: ${{ vars.DISCORDJS_APP_ID }}
3434
private-key: ${{ secrets.DISCORDJS_APP_KEY_RELEASE }}
3535

36-
- name: Decide ref
37-
id: ref
38-
run: |
39-
if [ -n "${{ github.event.inputs.pull }}" ]; then
40-
echo "ref=refs/pull/${{ github.event.inputs.pull }}/head" >> $GITHUB_OUTPUT
41-
else
42-
echo "ref=refs/heads/main" >> $GITHUB_OUTPUT
43-
fi
44-
4536
- name: Checkout repository
4637
uses: actions/checkout@v5
4738
with:
4839
fetch-depth: 0
4940
token: ${{ steps.app-token.outputs.token }}
50-
ref: ${{ steps.ref.outputs.ref }}
41+
ref: ${{ inputs.ref }}
5142

5243
- name: Install Node.js v24
5344
uses: actions/setup-node@v6
@@ -63,13 +54,13 @@ jobs:
6354
run: pnpm run build
6455

6556
- name: Checkout main repository (non-main ref)
66-
if: ${{ steps.ref.outputs.ref != 'refs/heads/main' }}
57+
if: ${{ inputs.ref != 'main' }}
6758
uses: actions/checkout@v5
6859
with:
6960
path: 'main'
7061

7162
- name: Install action deps (non-main ref)
72-
if: ${{ steps.ref.outputs.ref != 'refs/heads/main' }}
63+
if: ${{ inputs.ref != 'main' }}
7364
shell: bash
7465
working-directory: ./main
7566
env:
@@ -79,7 +70,7 @@ jobs:
7970
pnpm install --filter @discordjs/actions --frozen-lockfile --prefer-offline --loglevel error
8071
8172
- name: Publish packages (non-main ref)
82-
if: ${{ steps.ref.outputs.ref != 'refs/heads/main' }}
73+
if: ${{ inputs.ref != 'main' }}
8374
uses: ./main/packages/actions/src/releasePackages
8475
with:
8576
exclude: '@discordjs/docgen'
@@ -91,7 +82,7 @@ jobs:
9182
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9283

9384
- name: Publish packages (main ref)
94-
if: ${{ steps.ref.outputs.ref == 'refs/heads/main' }}
85+
if: ${{ inputs.ref == 'main' }}
9586
uses: ./packages/actions/src/releasePackages
9687
with:
9788
exclude: '@discordjs/docgen'

0 commit comments

Comments
 (0)