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: added release pipelines for slash #546

Merged
merged 1 commit into from
Oct 25, 2024
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
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.