All checks were successful
Publish to npm / publish (push) Successful in 19s
47 lines
1.3 KiB
YAML
47 lines
1.3 KiB
YAML
name: Publish to npm
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- dev
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v2
|
|
with:
|
|
node-version: '22'
|
|
registry-url: 'https://registry.npmjs.org/'
|
|
|
|
- name: Install dependencies
|
|
run: npm install
|
|
|
|
- name: Determine package name
|
|
id: package_name
|
|
run: |
|
|
if [ "${{ gitea.ref }}" == "refs/heads/main" ]; then
|
|
echo "PACKAGE_NAME=datenel-vue3" >> $GITEA_ENV
|
|
echo "ACCESS_LEVEL=public" >> $GITEA_ENV
|
|
elif [ "${{ gitea.ref }}" == "refs/heads/dev" ]; then
|
|
echo "PACKAGE_NAME=@astrian/datenel-vue3-dev" >> $GITEA_ENV
|
|
echo "ACCESS_LEVEL=restricted" >> $GITEA_ENV
|
|
fi
|
|
|
|
- name: Update package.json for dev releases
|
|
if: GITEA.ref == 'refs/heads/dev'
|
|
run: |
|
|
jq --arg name "@astrian/datenel-vue3-dev" '.name=$name' package.json > temp.json && mv temp.json package.json
|
|
jq --arg version "0.0.0-dev.$(date +%s)" '.version=$version' package.json > temp.json && mv temp.json package.json
|
|
|
|
- name: Publish to npm
|
|
run: npm publish --access $ACCESS_LEVEL
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|