Last active
October 22, 2023 23:24
-
-
Save eighty4/b565351b9c10f59d55e1e5507c8ba523 to your computer and use it in GitHub Desktop.
GitHub workflow to publish to npm a prerelease @Alpha or @next version of a package
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: CI with an npm @next publish | |
on: | |
push: | |
branches: [ main ] | |
paths: | |
- 'ui/**/*' | |
pull_request: | |
branches: [ main ] | |
jobs: | |
verified: | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- check | |
- lint | |
# - test | |
# - playwright | |
steps: | |
- run: echo "When you're on a holiday" | |
publish-prerelease: | |
name: Publish @next to npm | |
needs: verified | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
registry-url: https://registry.npmjs.org | |
- run: corepack enable && corepack prepare pnpm@latest --activate | |
- name: Build package | |
working-directory: ui | |
run: | | |
pnpm i | |
pnpm build | |
pnpm package | |
- name: Increment version | |
id: semver | |
working-directory: ui | |
run: echo "version=$(npm version prerelease --no-git-tag-version | tr -d '[:space:]')" >> "$GITHUB_OUTPUT" | |
- name: Publish prerelease | |
working-directory: ui | |
run: npm publish --public --tag next | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
- name: Bump ver > git | |
run: | | |
git config --global user.name "Adam McKee" | |
git config --global user.email "adam.be.g84d@gmail.com" | |
git commit -am "increment @eighty4/app-ui@next to ${{steps.semver.outputs.version}}" | |
git push | |
outputs: | |
version: ${{steps.semver.outputs.version}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment