Skip to content

Commit

Permalink
ci: documentation ci
Browse files Browse the repository at this point in the history
uploads storybooks to the gh page
  • Loading branch information
JLou committed Oct 15, 2024
1 parent 5e69fc5 commit df64158
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 16 deletions.
72 changes: 66 additions & 6 deletions .github/workflows/publish-slash.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@ name: Publish slash prerelease

on:
push:
branches:
- main
tags:
- "slash/*"

permissions:
contents: write
id-token: write

jobs:
build:
if: github.repository_owner == 'AxaFrance'
runs-on: ubuntu-latest
outputs:
version: ${{ steps.gitversion.outputs.fullSemVer }}
isPrerelease: ${{ steps.gitversion.outputs.preReleaseTag == '' }}
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -18,22 +25,75 @@ jobs:
with:
node-version: "*" # Use the LTS Node.js version
cache: "npm"
registry-url: 'https://registry.npmjs.org'
registry-url: "https://registry.npmjs.org"
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0
with:
versionSpec: '5.x'
versionSpec: "5.x"
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/execute@v0
with:
configFilePath: "GitVersion-slash.yml"
- run: npm run package:check
- run: npm ci
- run: npm run build:slash
- run: npm version "${{ steps.gitversion.outputs.fullSemVer }}" -w slash/css -w slash/react
- name: Set to react package the @axa-fr/design-system-slash-css dependency version
- run:
npm version "${{ steps.gitversion.outputs.fullSemVer }}" -w slash/css
-w slash/react
- name:
Set to react package the @axa-fr/design-system-slash-css dependency
version
run: |
cd slash/react
jq '.peerDependencies["@axa-fr/design-system-slash-css"] = "${{ steps.gitversion.outputs.fullSemVer }}"' package.json > temp.json && mv temp.json package.json
- run: npm publish -w slash/css -w slash/react --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: create artifact folder
run: mkdir -p artifact/css & mkdir -p artifact/react
- name: move storybooks to artifact folders
run:
cp -R slash/css/storybook-static/* artifact/css & cp -R
slash/react/storybook-static/* artifact/react
- uses: actions/upload-artifact@v3
with:
name: storybooks
path: |
artifact
retention-days: 2

deploy:
needs: build
if: needs.build.outputs.isPrerelease
runs-on: ubuntu-latest
name: Deploy new version of storybook to gh-pages
steps:
- name: Download math result for job 1
uses: actions/download-artifact@v4
with:
name: storybooks
- name: Upload the latest react storybook
uses: peaceiris/actions-gh-pages@v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./artifact/react
destination_dir: slash/react/latest
- name: Upload the react storybook to its version folder
uses: peaceiris/actions-gh-pages@v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./artifact/react
destination_dir: slash/react/${{ needs.build.outputs.version }}
- name: Upload the latest css storybook
uses: peaceiris/actions-gh-pages@v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./artifact/css
destination_dir: slash/css/latest
- name: Upload the css to its version folder
uses: peaceiris/actions-gh-pages@v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./artifact/css
destination_dir: slash/css/${{ needs.build.outputs.version }}
3 changes: 3 additions & 0 deletions GitVersion-slash.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mode: ContinuousDelivery
tag-prefix: 'slash/'
commit-message-incrementing: Disabled
10 changes: 0 additions & 10 deletions GitVersion.yml

This file was deleted.

0 comments on commit df64158

Please sign in to comment.