01 - Publish #514
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: 01 - Publish | |
env: | |
access: public | |
npmjs-registry: https://registry.npmjs.org | |
github-registry: https://npm.pkg.github.com | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
type: choice | |
description: Which NPM tag should be assigned? | |
options: | |
- '' | |
- dev | |
- next | |
- latest | |
- lts | |
version: # see https://github.com/lerna/lerna/tree/main/libs/commands/version#semver-bump | |
type: choice | |
description: SemVer keyword for version bump | |
options: | |
- prerelease | |
- prepatch | |
- patch | |
- preminor | |
- minor | |
- premajor | |
- major | |
label: # see https://github.com/lerna/lerna/tree/main/libs/commands/version#--preid | |
type: choice | |
description: SemVer pre release label (optional) | |
options: | |
- rc | |
- beta | |
- alpha | |
jobs: | |
publish: | |
if: github.repository == 'public-ui/kolibri' | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
packages: write | |
steps: | |
- uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
app-id: ${{ secrets.APP_ID }} | |
private-key: ${{ secrets.PRIVATE_KEY }} | |
- name: Get GitHub App User ID | |
id: get-user-id | |
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT" | |
env: | |
GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ steps.app-token.outputs.token }} | |
# https://github.com/pnpm/action-setup#use-cache-to-reduce-installation-time | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
registry-url: '${{env.npmjs-registry}}' | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
id: pnpm-install | |
with: | |
version: 9 | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
name: Setup pnpm cache | |
with: | |
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store | |
restore-keys: | | |
${{ runner.os }}-pnpm-store | |
- name: Set NPM dist-tags | |
if: github.event.inputs.tag != '' | |
run: | | |
packages=( | |
"packages/components" | |
"packages/adapters/angular/v15" | |
"packages/adapters/angular/v16" | |
"packages/adapters/angular/v17" | |
"packages/adapters/angular/v18" | |
"packages/adapters/react" | |
"packages/adapters/react-standalone" | |
"packages/adapters/solid" | |
"packages/adapters/vue" | |
"packages/adapters/preact" | |
"packages/adapters/hydrate" | |
"packages/tools/kolibri-cli" | |
"packages/themes/default" | |
"packages/themes" | |
"packages/samples/react" | |
"packages/tools/visual-tests" | |
) | |
for package in "${packages[@]}"; do | |
pkg_name=$(jq -r '.name' "$package/package.json") | |
npm dist-tag add "$pkg_name@$(jq -r '.version' "$package/package.json")" ${{github.event.inputs.tag}} | |
done | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}} | |
- name: Install | |
run: pnpm i --no-frozen-lockfile --no-verify-store-integrity | |
- name: Configure Git user | |
run: | | |
git config --local user.email "${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com" | |
git config --local user.name "${{ steps.app-token.outputs.app-slug }}[bot]" | |
- name: Bump versions without dev-tag and with git push | |
if: github.event.inputs.tag != 'dev' | |
run: 'HUSKY=0 npx lerna version ${{github.event.inputs.version}} --preid=${{github.event.inputs.label}} --no-private --tag-version-prefix="" -m "chore: release %v" -y --force-publish' | |
- name: Bump versions with dev-tag and without git push | |
if: github.event.inputs.tag == 'dev' | |
run: 'HUSKY=0 npx lerna version prerelease --preid=$GITHUB_SHA --no-private --tag-version-prefix="" -m "chore: release %v" -y --force-publish --no-push' | |
- name: Build | |
run: pnpm -r build | |
- name: Build and publish components | |
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}} | |
working-directory: packages/components | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}} | |
NPM_CONFIG_PROVENANCE: true | |
- name: Build and publish adapter angular v15 | |
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}} | |
working-directory: packages/adapters/angular/v15 | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}} | |
NPM_CONFIG_PROVENANCE: true | |
- name: Build and publish adapter angular v16 | |
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}} | |
working-directory: packages/adapters/angular/v16 | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}} | |
NPM_CONFIG_PROVENANCE: true | |
- name: Build and publish adapter angular v17 | |
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}} | |
working-directory: packages/adapters/angular/v17 | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}} | |
NPM_CONFIG_PROVENANCE: true | |
- name: Build and publish adapter angular v18 | |
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}} | |
working-directory: packages/adapters/angular/v18 | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}} | |
NPM_CONFIG_PROVENANCE: true | |
- name: Build and publish adapter react | |
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}} | |
working-directory: packages/adapters/react | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}} | |
NPM_CONFIG_PROVENANCE: true | |
- name: Build and publish adapter react-standalone | |
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}} | |
working-directory: packages/adapters/react-standalone | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}} | |
NPM_CONFIG_PROVENANCE: true | |
- name: Build and publish adapter solid | |
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}} | |
working-directory: packages/adapters/solid | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}} | |
NPM_CONFIG_PROVENANCE: true | |
- name: Build and publish adapter vue | |
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}} | |
working-directory: packages/adapters/vue | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}} | |
NPM_CONFIG_PROVENANCE: true | |
- name: Build and publish adapter preact | |
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}} | |
working-directory: packages/adapters/preact | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}} | |
NPM_CONFIG_PROVENANCE: true | |
- name: Build and publish adapter hydrate | |
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}} | |
working-directory: packages/adapters/hydrate | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}} | |
NPM_CONFIG_PROVENANCE: true | |
- name: Build and publish tools kolibri-cli | |
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}} | |
working-directory: packages/tools/kolibri-cli | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}} | |
NPM_CONFIG_PROVENANCE: true | |
- name: Build and publish theme default | |
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}} | |
working-directory: packages/themes/default | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}} | |
NPM_CONFIG_PROVENANCE: true | |
- name: Build and publish themes | |
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}} | |
working-directory: packages/themes | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}} | |
NPM_CONFIG_PROVENANCE: true | |
- name: Build and publish sample react | |
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}} | |
working-directory: packages/samples/react | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}} | |
NPM_CONFIG_PROVENANCE: true | |
- name: Build and publish tools visual-tests | |
run: pnpm publish --access ${{env.access}} --no-git-checks --tag ${{github.event.inputs.tag}} | |
working-directory: packages/tools/visual-tests | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPMJS_GRANULAR_TOKEN}} | |
NPM_CONFIG_PROVENANCE: true | |
# Publish packages on GitHub packages | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
registry-url: '${{env.github-registry}}' | |
- name: Publish designer | |
run: npm publish --access restricted | |
working-directory: packages/designer | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish sample react | |
run: npm publish --access restricted | |
working-directory: packages/samples/react | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |