v2.1.0 #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release version | |
on: | |
release: | |
types: [created] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- run: npm ci | |
- run: npm test | |
publish-npm-minor: | |
needs: build | |
runs-on: ubuntu-latest | |
if: contains(github.event.release.body, '#normal') | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
registry-url: https://registry.npmjs.org/ | |
- run: npm ci | |
- run: | | |
VERSION=$(echo $GITHUB_REF | sed 's/refs\/tags\///') # Odczytanie wersji z tagu | |
CURRENT_VERSION=$(node -p "require('./package.json').version") # Pobranie obecnej wersji z package.json | |
# Porównanie wersji i aktualizacja tylko jeśli wersja się różni | |
if [ "$VERSION" != "$CURRENT_VERSION" ]; then | |
echo "Updating version to $VERSION" | |
npm version $VERSION --no-git-tag-version | |
else | |
echo "Version is already up to date" | |
fi | |
# Publikowanie na npm | |
- run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOK }} | |
- name: Push new version tag | |
run: | | |
git push origin HEAD --tags |