feat: update bump version workflow #132
Workflow file for this run
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: 'Publish NT CSS Framework' | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: [closed] | |
jobs: | |
build-and-publish: | |
if: > | |
(github.event_name == 'workflow_dispatch' || | |
(github.event.pull_request.merged == true && | |
github.event.pull_request.base.ref == 'main' && | |
contains(github.event.pull_request.head.ref, 'bump-nt-stylesheet'))) | |
runs-on: | |
ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Authenticate with npm | |
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_ACCESS_TOKEN }}" > ~/.npmrc | |
- name: Install pnpm | |
run: npm install -g pnpm | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
working-directory: apps/nt-stylesheet | |
- name: Build CSS framework | |
run: pnpm run build | |
working-directory: apps/nt-stylesheet | |
- name: Publish to npm | |
run: npm publish | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} | |
working-directory: apps/nt-stylesheet | |
create-github-release: | |
name: Create GitHub Release | |
runs-on: ubuntu-latest | |
needs: build-and-publish | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Create Release | |
run: | | |
version=$(jq -r '.version' apps/nt-stylesheet/package.json) | |
gh release create "v$version" --generate-notes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |