Skip to content

Commit

Permalink
CI: Extract publish to its own workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Mintoo200 committed Mar 21, 2024
1 parent baee2d9 commit 6b790f3
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 23 deletions.
26 changes: 3 additions & 23 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,6 @@ jobs:
artifact_name: "storybook-latest"
publish-package:
needs: build
permissions:
packages: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
# TODO: add version to a .nvmrc or at least a variable
node-version: 18.12.1
cache: npm
registry-url: 'https://npm.pkg.github.com'
- name: Install
run: npm ci --omit=dev --prefer-offline
- name: Download dist
uses: actions/download-artifact@v4
with:
name: "lib-latest"
path: "./dist"
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: ./.github/workflows/publish-package.yml
with:
package-name: "lib-latest"
42 changes: 42 additions & 0 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: 'Publish package'

on:
workflow_call:
inputs:
artifact-name:
description: name of the artifact to publish
required: true
type: string
workflow_dispatch:
inputs:
artifact-name:
description: name of the artifact to publish
required: false
type: string
default: "lib-latest"

jobs:
publish-package:
permissions:
packages: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
# TODO: add version to a .nvmrc or at least a variable
node-version: 18.12.1
cache: npm
registry-url: 'https://npm.pkg.github.com'
- name: Install
run: npm ci --omit=dev --prefer-offline
- name: Download dist
uses: actions/download-artifact@v4
with:
name: ${{ inputs.artifact-name }}
path: "./dist"
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 6b790f3

Please sign in to comment.