Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Extract publish and pages to their own workflow #15

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 6 additions & 36 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,41 +22,11 @@ jobs:
artifact-name: "storybook-latest"
deploy-page:
needs: build-storybook
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
artifact_name: "storybook-latest"
uses: ./.github/workflows/deploy-storybook.yml
with:
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"
32 changes: 32 additions & 0 deletions .github/workflows/deploy-storybook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: 'Deploy Storybook'

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

jobs:
deploy-page:
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
artifact_name: ${{ inputs.artifact-name }}
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 }}