|
| 1 | +name: 'Release' |
| 2 | +description: 'Releases a package' |
| 3 | +inputs: |
| 4 | + scope: |
| 5 | + description: 'The package to release. Must match a package specified in lerna.json.' |
| 6 | + version: |
| 7 | + description: 'The type of version to release.' |
| 8 | + tag: |
| 9 | + description: 'The tag to publish to on NPM.' |
| 10 | + preid: |
| 11 | + description: "Prerelease identifier such as 'alpha', 'beta', 'rc', or 'next'. Leave blank to skip prerelease tagging." |
| 12 | + working-directory: |
| 13 | + description: 'The directory of the package.' |
| 14 | + folder: |
| 15 | + default: './' |
| 16 | + description: 'A folder containing a package.json file.' |
| 17 | + node-version: |
| 18 | + description: 'Node.js version to use when publishing.' |
| 19 | + required: false |
| 20 | + default: '24.x' |
| 21 | +runs: |
| 22 | + using: 'composite' |
| 23 | + steps: |
| 24 | + - name: 🟢 Configure Node for Publish |
| 25 | + uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 |
| 26 | + with: |
| 27 | + node-version: ${{ inputs.node-version }} |
| 28 | + registry-url: 'https://registry.npmjs.org' |
| 29 | + # Provenance requires npm 9.5.0+ |
| 30 | + - name: 📦 Install latest npm |
| 31 | + run: npm install -g npm@latest |
| 32 | + shell: bash |
| 33 | + # This ensures the local version of Lerna is installed |
| 34 | + # and that we do not use the global Lerna version |
| 35 | + - name: 🕸️ Install root dependencies |
| 36 | + run: npm ci |
| 37 | + shell: bash |
| 38 | + - name: 📦 Install Dependencies |
| 39 | + run: npx lerna@5 bootstrap --include-dependencies --scope ${{ inputs.scope }} --ignore-scripts -- --legacy-peer-deps |
| 40 | + shell: bash |
| 41 | + working-directory: ${{ inputs.working-directory }} |
| 42 | + - name: 🏷️ Set Version |
| 43 | + run: | |
| 44 | + if [ -z "${{ inputs.preid }}" ]; then |
| 45 | + npx lerna@5 version ${{ inputs.version }} --yes --exact --no-changelog --no-push --no-git-tag-version |
| 46 | + else |
| 47 | + npx lerna@5 version ${{ inputs.version }} --yes --exact --no-changelog --no-push --no-git-tag-version --preid=${{ inputs.preid }} |
| 48 | + fi |
| 49 | + shell: bash |
| 50 | + working-directory: ${{ inputs.working-directory }} |
| 51 | + - name: 🏗️ Run Build |
| 52 | + run: npm run build |
| 53 | + shell: bash |
| 54 | + working-directory: ${{ inputs.working-directory }} |
| 55 | + - name: 🚀 Publish to NPM |
| 56 | + run: npm publish ${{ inputs.folder }} --tag ${{ inputs.tag }} --provenance |
| 57 | + shell: bash |
| 58 | + working-directory: ${{ inputs.working-directory }} |
0 commit comments