Skip to content

Publish Package

Publish Package #11

Workflow file for this run

name: Publish Package
on:
workflow_dispatch:
push:
tags:
- "v*"
permissions:
id-token: write # Required for OIDC
contents: write
jobs:
publish:
if: github.event.base_ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- run: ${{ toJson(github.event) }}
shell: cat {0}
- name: test
run: echo ${{ toJson(github) }}
- name: test 2
run: echo ${{ toJson(github.head_ref) }}
- name: Setup npm
uses: actions/setup-node@v4
with:
node-version: 24
registry-url: https://registry.npmjs.org/
- name: Setup bun
uses: oven-sh/setup-bun@v2
- name: Cache dependencies
id: deps-cache
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-deps-${{ hashFiles('./bun.lock') }}
- name: Install dependencies
if: steps.deps-cache.outputs.cache-hit != 'true'
run: bun ci
- name: Run tests
run: bun test
- name: Get version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Update package.json version
run: npm version ${{ steps.get_version.outputs.VERSION }} --no-git-tag-version
- name: Commit version update
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add package.json
git commit -m "chore: bump version to ${{ steps.get_version.outputs.VERSION }}"
git push origin HEAD:main
- name: Build
run: bun run build
# - name: Publish
# run: npm publish --provenance