Skip to content

(chore): publish package #74

(chore): publish package

(chore): publish package #74

name: Release Package
on:
push:
branches: ["main"]
# paths:
# - "!README.md"
jobs:
build:
name: Build package
runs-on: ubuntu-latest
outputs:
new-version: ${{ steps.newVersion.outputs.new-version }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- run: npm ci
- run: npm run test
- run: npm run build
- name: Get new Version
id: newVersion
run: |
PACKAGE_VERSION=$(node -p "require('./package.json').version")
echo "new-version=$PACKAGE_VERSION" >> "$GITHUB_OUTPUT"
echo "New version number: $PACKAGE_VERSION"
releaseNote:
needs: build
name: Create release notes
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Create release and tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ needs.build.outputs.new-version }}
run: |
gh release create "$tag" \
--repo="$GITHUB_REPOSITORY" \
--title="${tag}" \
--generate-notes
publish-gpr:
needs: releaseNote
name: Publish package
if: github.repository_owner == 'josh-uvi' #safeguard for forks
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://npm.pkg.github.com/
scope: "@josh-uvi"
- name: start ci
run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}