Skip to content

pipeline fix

pipeline fix #12

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
jobs:
update-master-to-tagged-version:
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@v3
with:
ref: main
fetch-depth: 0
- name: Extract version from latest Git tag or use default
run: |
TAG_NAME=$(git tag | tail -n 1)
VERSION=${TAG_NAME#*v}
if [[ -z "$VERSION" ]]; then
VERSION="0.0.1" # Default version
fi
npm version $VERSION --no-git-tag-version
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Commit and push updated package.json on main
run: |
git config --local user.email "${{ secrets.GIT_USER_EMAIL }}"
git config --local user.name "maphel"
git add package.json
git commit -m "Update package.json version to ${{ env.VERSION }} on main"
git push origin main
publish:
needs: update-master-to-tagged-version
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
- name: Install Yarn 3 (Berry)
run: npm install -g yarn@berry
- name: Set up Yarn 3
run: yarn set version berry
- name: Install dependencies
run: yarn install --immutable
- name: Build
run: yarn build
- name: Exclude source maps
run: rm -rf dist/**/*.map
- name: Publish to NPM
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}