Skip to content

Add github packahe publish #20

Add github packahe publish

Add github packahe publish #20

Workflow file for this run

name: CI/CD Pipeline
on:
release:
types:
- published
jobs:
build-test-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Set up Bun
uses: oven-sh/setup-bun@v2
- name: Update version in package.json to match release tag
run: |
RELEASE_TAG=${GITHUB_REF#refs/tags/}
jq --arg tag "$RELEASE_TAG" '.version = $tag' package.json > package.json.tmp && mv package.json.tmp package.json
git config user.name "github-actions"
git config user.email "[email protected]"
git commit -am "Update version to match release tag $RELEASE_TAG"
git push
- name: Install dependencies
run: bun i
- name: Build the project
run: bun run build
- name: Log in to npm
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
- name: Publish to npm
if: startsWith(github.ref, 'refs/tags/')
run: npm publish --access public

Check failure on line 44 in .github/workflows/publish.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/publish.yml

Invalid workflow file

You have an error in your yaml syntax on line 44
- name: Publish to GitHub Packages
if: startsWith(github.ref, 'refs/tags/')
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "@${{ github.repository_owner }}:registry=https://npm.pkg.github.com" >> ~/.npmrc
npm publish --registry=https://npm.pkg.github.com
- name: Upload Build Artifacts
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./dist
asset_name: build.zip
asset_content_type: application/zip