Skip to content

Bump Version and Publish to npm #32

Bump Version and Publish to npm

Bump Version and Publish to npm #32

Workflow file for this run

name: Bump Version and Publish to npm
on:
release:
types: [created]
jobs:
bump-version-and-publish:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Install dependencies
run: npm ci
- name: Create lib
run: npm run ci
- name: Extract release version
id: extract_version
run: |
echo "RELEASE_VERSION=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Checkout, bun, commit and push version change
run: |
git fetch origin main
git checkout main
npx json -I -f package.json -e "this.version='${RELEASE_VERSION}'"
npx json -I -f package-lock.json -e "this.version='${RELEASE_VERSION}'"
git add package.json package-lock.json
git commit -m "🔖 release: bump version to ${RELEASE_VERSION}" --no-verify
git push origin main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Authenticate with GitHub Packages
run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc
- name: Authenticate with npmjs
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
- name: Publish to GitHub Packages
run: npm publish --registry https://npm.pkg.github.com/
- name: Publish to npm
run: npm publish --registry https://registry.npmjs.org/
- name: Send new version of the package to Konstruct Slack
run: |
curl -X POST https://n8n-production.mgmt-24.konstruct.io/webhook/konstruct-ui/updates \
-H "Content-Type: application/json" \
-d '{
"package_name": "${{ github.event.repository.name }}",
"version": "${RELEASE_VERSION}",
"url": "${{ github.event.release.html_url }}",
"repository": "${{ github.event.repository.html_url }}",
"storybook": "https://konstructio.github.io/konstruct-ui",
}'