configure CI/cD github workflows #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release new stable version (main) | |
on: | |
push: | |
branches: [main] | |
concurrency: release-new-version | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
packages: write | |
actions: write | |
pull-requests: write | |
jobs: | |
releaseNewVersion: | |
name: "Release new version" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: "Setup Project" | |
uses: ./.github/actions/setup-project | |
# with: | |
# PACKAGE_REGISTRY_TOKEN: ${{ secrets.PACKAGE_REGISTRY_TOKEN }} | |
# - name: "Authenticate with GitHub package registry (publish)" | |
# run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.PACKAGE_REGISTRY_TOKEN }}" > ~/.npmrc | |
- name: "Check code style" | |
run: pnpm lint | |
- name: "Run tests" | |
run: pnpm test:ci:coverage | |
- name: "Build project" | |
run: pnpm build | |
- name: "Prepare git" | |
run: | | |
git config --global user.email "noreply@github.com" | |
git config --global user.name "github-actions" | |
git branch -u origin/main main | |
- name: "Increase build versions" | |
run: pnpm standard-version --tag-prefix --commit-all | |
- name: "Push new version to git" | |
run: | | |
git add . | |
git push --follow-tags | |
- name: "Publish package" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_REGISTRY_TOKEN }} | |
run: pnpm publish --no-git-checks | |
publishStorybook: | |
name: "Publish Storybook to GitHub Pages" | |
runs-on: ubuntu-latest | |
needs: [releaseNewVersion] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: "Setup Project" | |
uses: ./.github/actions/setup-project | |
# with: | |
# PACKAGE_REGISTRY_TOKEN: ${{ secrets.PACKAGE_REGISTRY_TOKEN }} | |
# - name: "Authenticate with GitHub package registry (publish)" | |
# run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.PACKAGE_REGISTRY_TOKEN }}" > ~/.npmrc | |
- name: "Build storybook" | |
run: pnpm build:storybook | |
- uses: bitovi/github-actions-storybook-to-github-pages@v1.0.3 | |
with: | |
install_command: pnpm install # default: npm ci | |
build_command: pnpm build:storybook # default: npm run build-storybook | |
path: storybook-static # default: dist/storybook | |
checkout: false # default: true |