Skip to content

Publish

Publish #49

Workflow file for this run

name: 'Publish'
on:
workflow_dispatch:
inputs:
next_version:
type: 'string'
description: 'version (e.g. 3.4.0-alpha.0)'
required: true
skip_publish:
type: 'boolean'
description: 'mark in case only the version update shall be executed, skipping the release to npm'
required: true
skip_push:
type: 'boolean'
description: 'mark in case the version update shall not be pushed back to the repository'
required: true
stable_release:
type: 'boolean'
description: 'mark in case this is a full stable release (flag is ignored in case publish is skipped)'
required: true
jobs:
publish:
permissions:
contents: 'write'
id-token: 'write' # Required for npm OIDC
runs-on: 'ubuntu-latest'
steps:
- uses: 'actions/checkout@v4'
with:
token: '${{ secrets.JSONFORMS_PUBLISH_PAT }}'
- name: 'Configure Git Credentials'
run: |
git config user.name "jsonforms-publish[bot]"
git config user.email "[email protected]"
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
name: Install pnpm
id: pnpm-install
with:
run_install: false
- name: 'Setup node'
uses: 'actions/setup-node@v4'
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org'
# Ensure npm 11.5.1 or later for trusted publishing
- name: Update npm
run: npm install -g npm@latest
- name: 'Install Packages'
run: 'pnpm i --frozen-lockfile'
- name: 'Build'
run: 'pnpm run build'
- name: 'Test'
run: 'pnpm run test'
- name: 'Versioning'
run: 'pnpm exec lerna version ${{ github.event.inputs.next_version }} --no-push --force-publish --yes'
- name: 'Adjust PeerDependencies'
run: |
cd packages/angular && pnpm pkg set peerDependencies.@jsonforms/core="${{ github.event.inputs.next_version }}"
cd ../angular-material && pnpm pkg set peerDependencies.@jsonforms/core="${{ github.event.inputs.next_version }}" && pnpm pkg set peerDependencies.@jsonforms/angular="${{ github.event.inputs.next_version }}"
cd ../examples && pnpm pkg set peerDependencies.@jsonforms/core="${{ github.event.inputs.next_version }}"
cd ../material-renderers && pnpm pkg set peerDependencies.@jsonforms/core="${{ github.event.inputs.next_version }}" && pnpm pkg set peerDependencies.@jsonforms/react="${{ github.event.inputs.next_version }}"
cd ../react && pnpm pkg set peerDependencies.@jsonforms/core="${{ github.event.inputs.next_version }}"
cd ../vanilla-renderers && pnpm pkg set peerDependencies.@jsonforms/core="${{ github.event.inputs.next_version }}" && pnpm pkg set peerDependencies.@jsonforms/react="${{ github.event.inputs.next_version }}"
cd ../vue && pnpm pkg set peerDependencies.@jsonforms/core="${{ github.event.inputs.next_version }}"
cd ../vue-vanilla && pnpm pkg set peerDependencies.@jsonforms/core="${{ github.event.inputs.next_version }}" && pnpm pkg set peerDependencies.@jsonforms/vue="${{ github.event.inputs.next_version }}"
cd ../vue-vuetify && pnpm pkg set peerDependencies.@jsonforms/core="${{ github.event.inputs.next_version }}" && pnpm pkg set peerDependencies.@jsonforms/vue="${{ github.event.inputs.next_version }}"
- name: 'Tag and Commit'
run: |
git add -A && git commit --amend --no-edit
git tag v${{ github.event.inputs.next_version }} -f
- name: 'push'
if: github.event.inputs.skip_push == 'false'
run: |
git push
git push origin v${{ github.event.inputs.next_version }}
- name: 'Publish to npm'
if: github.event.inputs.skip_publish == 'false'
run: "pnpm publish --recursive ${{ github.event.inputs.stable_release == 'true' && ' ' || '--tag next' }}"
env:
NPM_CONFIG_PROVENANCE: 'true'