55 lines
1.4 KiB
YAML
55 lines
1.4 KiB
YAML
name: Publish npm package
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
|
|
- name: Set version from tag
|
|
run: |
|
|
VERSION=${GITHUB_REF_NAME#v}
|
|
echo "Setting package version to $VERSION"
|
|
git fetch origin main
|
|
git checkout main
|
|
npm pkg set version="$VERSION"
|
|
git config user.name "versioning"
|
|
git config user.email "versioning@blassanto.me"
|
|
git remote set-url origin https://x-token:${GITEA_TOKEN}@git.blassanto.me/blas/openapi-clean-arch-gen.git
|
|
git add package.json
|
|
git commit -m "chore: bump to version v${VERSION}"
|
|
git push origin main
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.TOKEN }}
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Lint
|
|
run: npm run lint
|
|
|
|
- name: Build
|
|
run: npm run build
|
|
|
|
- name: Configure Gitea registry auth
|
|
run: |
|
|
echo "//git.blassanto.me/api/packages/blas/npm/:_authToken=${NODE_AUTH_TOKEN}" >> ~/.npmrc
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.TOKEN }}
|
|
|
|
- name: Publish to Gitea
|
|
run: npm publish
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.TOKEN }}
|