Skip to content

feat: add browsers list, linting plugin and Docs section with support… #722

feat: add browsers list, linting plugin and Docs section with support…

feat: add browsers list, linting plugin and Docs section with support… #722

Workflow file for this run

name: Release
on:
push:
branches:
- "main"
workflow_dispatch:
env:
# The release + deployment will be done on "prod" stage if on main branch, on "dev" stage otherwise
STAGE: ${{ github.ref_name == 'main' && 'prod' || 'dev' }}
jobs:
release:
name: Release
runs-on: ubuntu-latest
environment: ${{ github.ref_name == 'main' && 'prod' || 'dev' }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.GH_PUSH_PROTECTED_KEY }}
# needed when building VitePress docs so timestamps can be calculated correctly
fetch-depth: 0
- uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: pnpm
registry-url: "https://registry.npmjs.org/"
scope: sit-onyx
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: 📦 Install dependencies
run: pnpm install
- name: 🛠️ Build packages
run: pnpm build:all --filter=!docs
- name: Upload Storybook artifact
uses: actions/upload-artifact@v4
with:
name: storybook-static
path: packages/sit-onyx/storybook-static
- name: Upload playground artifact
uses: actions/upload-artifact@v4
with:
name: playground
path: apps/playground/dist
- name: 🤖 Configure Git Bot
run: |
git config user.name "Release Bot[bot]"
git config user.email "[email protected]"
- name: ⛴️ Version and Publish
if: ${{ env.STAGE == 'prod' }}
run: |
npx changeset version
npx changeset publish
git add --all
if [[ `git status --porcelain` ]]; then
git commit --amend --no-edit
git push --follow-tags
else
echo "No new version. Nothing to commit."
fi
- name: 📸 Snapshot and Publish
if: ${{ env.STAGE != 'prod' }}
run: |
# [Snapshot release fails if repository is in pre-release mode](https://github.com/changesets/changesets/issues/1195)
rm -f .changeset/pre.json
# Add empty changeset so we always have a new snapshot release for each new run
npx changeset add --empty
npx changeset version --snapshot
npx changeset publish --tag snapshot
# the docs need to be build AFTER the release because there the changelogs are generated which need to be included in the
# documentation build
- name: 🛠️ Build docs
run: pnpm build:all --filter=docs
env:
# needed for increase rate limit for the GitHub API that is used when building
# the VitePress documentation
VITEPRESS_GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload documentation artifact
uses: actions/upload-artifact@v4
with:
name: documentation
path: apps/docs/src/.vitepress/dist
deploy_storybook:
name: Deploy Storybook
runs-on: ubuntu-latest
needs: release
environment: ${{ github.ref_name == 'main' && 'prod' || 'dev' }}
steps:
- uses: actions/checkout@v4
- name: Download Storybook artifact
uses: actions/download-artifact@v4
with:
name: storybook-static
path: packages/sit-onyx/.cloud-foundry/storybook-static
- name: Deploy to Cloud Foundry
uses: ./.github/templates/cf-push
with:
endpoint: ${{ vars.CF_ENDPOINT }}
org: ${{ vars.CF_ORG }}
username: ${{ vars.CF_USERNAME }}
password: ${{ secrets.CF_PASSWORD }}
space: ${{ env.STAGE }}
working-directory: packages/sit-onyx/.cloud-foundry
deploy_documentation:
name: Deploy documentation
runs-on: ubuntu-latest
needs: release
environment: ${{ github.ref_name == 'main' && 'prod' || 'dev' }}
steps:
- uses: actions/checkout@v4
- name: Download Storybook artifact
uses: actions/download-artifact@v4
with:
name: documentation
path: apps/docs/.cloud-foundry/dist
- name: Deploy to Cloud Foundry
uses: ./.github/templates/cf-push
with:
endpoint: ${{ vars.CF_ENDPOINT }}
org: ${{ vars.CF_ORG }}
username: ${{ vars.CF_USERNAME }}
password: ${{ secrets.CF_PASSWORD }}
space: ${{ env.STAGE }}
working-directory: apps/docs/.cloud-foundry
deploy_playground:
name: Deploy Playground
runs-on: ubuntu-latest
needs: release
environment: ${{ github.ref_name == 'main' && 'prod' || 'dev' }}
steps:
- uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: playground
path: apps/playground/.cloud-foundry/dist
- name: Deploy to Cloud Foundry
uses: ./.github/templates/cf-push
with:
endpoint: ${{ vars.CF_ENDPOINT }}
org: ${{ vars.CF_ORG }}
username: ${{ vars.CF_USERNAME }}
password: ${{ secrets.CF_PASSWORD }}
space: ${{ env.STAGE }}
working-directory: apps/playground/.cloud-foundry