Skip to content

Commit 91b0e1a

Browse files
authored
chore: update publish pipeline to be run via workflow_call from release pipeline (#304)
1 parent 7fb7069 commit 91b0e1a

File tree

2 files changed

+15
-23
lines changed

2 files changed

+15
-23
lines changed

.github/workflows/publish.yml

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,24 @@ name: Publish
44

55
on:
66
workflow_dispatch:
7+
workflow_call:
8+
inputs:
9+
branch:
10+
description: The branch containing the release code snapshot
11+
required: true
12+
type: string
13+
default: ""
714
push:
815
branches:
916
- main
10-
tags:
11-
- 'v*.*.*'
12-
release:
13-
types:
14-
- published
1517

1618
permissions:
1719
contents: write
1820
id-token: write
1921

2022
jobs:
2123
publish-ea:
22-
if: startsWith(github.ref, 'refs/tags/') == false
24+
if: github.event_name == 'push'
2325
runs-on: ubuntu-latest
2426
name: Publish EA release to NPM
2527
steps:
@@ -70,14 +72,14 @@ jobs:
7072
npm publish --verbose --tag ea --access public --provenance
7173
7274
publish-release:
73-
if: startsWith(github.ref, 'refs/tags/')
75+
if: github.event_name == 'workflow_call' || github.event_name == 'workflow_dispatch'
7476
runs-on: ubuntu-latest
7577
name: Publish release to NPM
7678
steps:
7779
- name: Checkout sources
7880
uses: actions/checkout@v4
7981
with:
80-
ref: ${{ github.ref }}
82+
ref: ${{ inputs.branch || github.ref }}
8183
fetch-depth: 0
8284

8385
- name: Install node 24
@@ -90,21 +92,6 @@ jobs:
9092
- name: Update npm
9193
run: npm install -g npm@latest
9294

93-
- name: Get tag name
94-
id: tag
95-
run: |
96-
TAG_NAME=${GITHUB_REF#refs/tags/}
97-
echo "name=$TAG_NAME" >> "$GITHUB_OUTPUT"
98-
99-
- name: Update package.json with tag version
100-
id: update-version
101-
run: |
102-
TAG_NAME="${{ steps.tag.outputs.name }}"
103-
# Remove 'v' prefix if present
104-
VERSION=${TAG_NAME#v}
105-
npm version "$VERSION" --no-git-tag-version
106-
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
107-
10895
- name: Install project modules
10996
run: npm ci
11097

.github/workflows/release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,8 @@ jobs:
111111
env:
112112
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113113

114+
- name: Run Publish pipeline
115+
uses: ./.github/workflows/publish.yml
116+
with:
117+
branch: "release/v${{ steps.bump.outputs.version }}"
118+

0 commit comments

Comments
 (0)