Skip to content

Commit

Permalink
Chore: update publish to chromatic and npm CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
rhannachi committed Jul 27, 2023
1 parent 3f68028 commit ce0f815
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 8 deletions.
45 changes: 41 additions & 4 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,21 @@ jobs:
- name: zip storybook-static
run: tar -czf storybook-static.tar.gz ./storybook-static

- name: Upload artifact
- name: Upload storybook-static artifact
uses: actions/upload-artifact@v3
with:
name: my_storybook-static_artifact
path: storybook-static.tar.gz

- name: zip dist
run: tar -czf dist.tar.gz ./dist

- name: Upload dist artifact
uses: actions/upload-artifact@v3
with:
name: my_dist_artifact
path: dist.tar.gz

################################## TEST #########################################

test:
Expand Down Expand Up @@ -270,9 +279,9 @@ jobs:
################################## DEPLOYMENT ########################################

publish:
publish-npm:
needs: [release]
name: "Publish to Chromatic and NPM"
name: "Publish to NPM"
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
environment:
Expand Down Expand Up @@ -302,19 +311,47 @@ jobs:
- name: unzip node_modules
run: tar -xzf node_modules.tar.gz

- name: Load artifact dist
uses: actions/download-artifact@v3
with:
name: my_dist_artifact

- name: unzip dist
run: tar -xzf dist.tar.gz

- name: Set deployment token
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"

- name: Publish to NPM
run: pnpm publish --access=public --no-git-checks

publish-chromatic:
needs: [release]
name: "Publish to Chromatic"
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
environment:
name: Production
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # 👈 Required to retrieve git history

- name: Load artifact storybook-static
uses: actions/download-artifact@v3
with:
name: my_storybook-static_artifact

- name: unzip storybook-static
run: tar -xzf storybook-static.tar.gz

- name: Publish to Chromatic
id: chromatic
uses: chromaui/action@v1
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
buildScriptName: build
storybookBuildDir: 'storybook-static'

- name: Publish Chromatic Summary
run: echo -e "| Results | |\n| --- | --- |\n| Build Results | ${{steps.chromatic.outputs.buildUrl}} |\n| Storybook Preview | ${{steps.chromatic.outputs.storybookUrl}} |\n| Component Count | ${{steps.chromatic.outputs.componentCount}} |" >> $GITHUB_STEP_SUMMARY
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.1.5] - 2023-07-27
### Chore
* chore: update publish to chromatic and npm CI.
### Contributors to this release
* Ramzi Hannachi ([@rhannachi](https://github.com/rhannachi))

## [1.1.4] - 2023-07-25
### Features
* add new colors for `Icon`.
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"name": "@rhannachi/components",
"author": "rhannachi",
"version": "1.1.4",
"version": "1.1.5",
"license": "MIT",
"main": "dist/index.js",
"module": "dist/index.esm.js",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"files": ["dist"],
"homepage": "https://main--648f1b983076c579eab28ee1.chromatic.com",
"repository": "https://github.com/rhannachi/storybook-react.git",
"description": "Storybook design systems",
"scripts": {
Expand Down

0 comments on commit ce0f815

Please sign in to comment.