Skip to content

GitHub CI - Publish to NPM #979

GitHub CI - Publish to NPM

GitHub CI - Publish to NPM #979

# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: GitHub CI - Publish to NPM
on:
workflow_dispatch:
release:
types:
- released
env:
access: public
alias: leanup
registry: https://registry.npmjs.org
tag: latest
token: ${{ secrets.NPMJS_AUTH_TOKEN }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
# https://github.com/pnpm/action-setup#use-cache-to-reduce-installation-time
- uses: actions/setup-node@v4
with:
# cache: pnpm
node-version: 20
registry-url: '${{env.registry}}'
scope: '@${{env.alias}}'
- uses: pnpm/action-setup@v4
id: pnpm-install
with:
version: 9
run_install: false
- id: pnpm-cache
shell: bash
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store
restore-keys: |
${{ runner.os }}-pnpm-store
- run: pnpm i
- name: Install and publish only @${{env.alias}}/stack
run: pnpm publish --access=${{env.access}} --no-git-checks --tag=${{env.tag}} || true
working-directory: packages/stack/core
env:
NODE_AUTH_TOKEN: ${{env.token}}
- name: Install and publish only @${{env.alias}}/stack-snowpack
continue-on-error: true
run: pnpm publish --access=${{env.access}} --no-git-checks --tag=${{env.tag}} || true
working-directory: packages/stack/snowpack
env:
NODE_AUTH_TOKEN: ${{env.token}}
- name: Install and publish only @${{env.alias}}/stack-vite
continue-on-error: true
run: pnpm publish --access=${{env.access}} --no-git-checks --tag=${{env.tag}} || true
working-directory: packages/stack/vite
env:
NODE_AUTH_TOKEN: ${{env.token}}
- name: Install and publish only @${{env.alias}}/stack-webpack
continue-on-error: true
run: pnpm publish --access=${{env.access}} --no-git-checks --tag=${{env.tag}} || true
working-directory: packages/stack/webpack
env:
NODE_AUTH_TOKEN: ${{env.token}}
- name: Install and publish only @${{env.alias}}/lib
continue-on-error: true
run: pnpm publish --access=${{env.access}} --no-git-checks --tag=${{env.tag}} || true
working-directory: packages/lib
env:
NODE_AUTH_TOKEN: ${{env.token}}
- name: Install and publish only @${{env.alias}}/cli-core-babel
continue-on-error: true
run: pnpm publish --access=${{env.access}} --no-git-checks --tag=${{env.tag}} || true
working-directory: packages/cli/core/babel
env:
NODE_AUTH_TOKEN: ${{env.token}}
- name: Install and publish only @${{env.alias}}/cli
continue-on-error: true
run: pnpm publish --access=${{env.access}} --access=public --tag=${{env.tag}} || true
working-directory: packages/cli/core
env:
NODE_AUTH_TOKEN: ${{env.token}}
- name: Install and publish non @${{env.alias}}/cli, @${{env.alias}}/cli-core-babel, @${{env.alias}}/lib, @${{env.alias}}/stack, @${{env.alias}}/stack-snowpack, @${{env.alias}}/stack-vite and @${{env.alias}}/stack-webpack
continue-on-error: true
run: |
rm -rf packages/stack/core/dist packages/stack/webpack/dist
pnpm i --no-frozen-lockfile
npx lerna exec --no-bail --stream -- pnpm pack || true
npx lerna exec --ignore=@template/* --ignore @${{env.alias}}/cli --ignore @${{env.alias}}/cli-core-babel --ignore @${{env.alias}}/lib --ignore @${{env.alias}}/stack --ignore @${{env.alias}}/stack-snowpack --ignore @${{env.alias}}/stack-vite --ignore @${{env.alias}}/stack-webpack --no-bail --stream -- pnpm publish --access=${{env.access}} --no-git-checks --tag=${{env.tag}} || true
env:
NODE_AUTH_TOKEN: ${{env.token}}
- name: Test all framework variants
continue-on-error: true
run: |
rm ../.eslintrc.js
sh wake-up-all.sh ${{env.alias}} ${{env.tag}}
working-directory: scripts
env:
NODE_AUTH_TOKEN: ${{env.token}}