[READ-ONLY] Mirror of https://github.com/danielroe/uppt. A composite GitHub Action that turns conventional commits into a draft release PR, tags the PR on merge, and stages publishing to npm via OIDC
github-action npm npmjs oidc staged-publish trusted-publishing
0

Configure Feed

Select the types of activity you want to include in your feed.

uppt / publish / action.yml
2.2 kB 67 lines
1name: 'uppt/publish' 2description: 'Stage-publish a prebuilt tarball to npm using OIDC trusted publishing.' 3author: 'Daniel Roe' 4 5branding: 6 icon: 'package' 7 color: 'black' 8 9inputs: 10 node-version: 11 description: 'Node version for the scripts and for `npm stage publish`. Needs `--experimental-strip-types` support (22.6+, 24+ recommended).' 12 required: false 13 default: '24' 14 npm-access: 15 description: 'npm access level (`public` or `restricted`).' 16 required: false 17 default: 'public' 18 files: 19 description: 'Optional JSON array of tarball filenames to publish, as emitted by `uppt/pack`''s `files` output. When omitted, the action publishes every `*.tgz` it finds in the downloaded artifact.' 20 required: false 21 default: '' 22 23runs: 24 using: composite 25 steps: 26 - name: Validate event 27 shell: bash 28 env: 29 EVENT_NAME: ${{ github.event_name }} 30 run: | 31 set -euo pipefail 32 case "$EVENT_NAME" in 33 push|workflow_dispatch) ;; 34 *) 35 echo "::error::danielroe/uppt/publish only supports 'push' and 'workflow_dispatch' events, got '$EVENT_NAME'." 36 exit 1 37 ;; 38 esac 39 if [ "${GITHUB_REF:-}" = "${GITHUB_REF#refs/tags/v}" ]; then 40 echo "::error::danielroe/uppt/publish expected a 'refs/tags/v*' ref, got '${GITHUB_REF:-<unset>}'." 41 exit 1 42 fi 43 44 - name: Setup Node 45 uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 46 with: 47 node-version: ${{ inputs.node-version }} 48 registry-url: 'https://registry.npmjs.org' 49 package-manager-cache: false 50 51 - name: Update npm 52 shell: bash 53 run: npm install -g npm@latest 54 55 - name: Download tarball artifact 56 uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 57 with: 58 name: uppt-tarball 59 path: ${{ runner.temp }}/uppt-tarballs 60 61 - name: Publish to npm 62 shell: bash 63 env: 64 NPM_ACCESS: ${{ inputs.npm-access }} 65 TARBALL_DIR: ${{ runner.temp }}/uppt-tarballs 66 TARBALL_FILES: ${{ inputs.files }} 67 run: node --experimental-strip-types ${{ github.action_path }}/../scripts/publish.ts