Files
pulumi-npm-release/Taskfile.base.yml
2026-04-01 18:52:47 +03:00

78 lines
2.1 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: '3'
set: [ e, pipefail, u, x ]
env:
NPM_TAG:
sh: |
tag=dev
if [[ "$GITHUB_REF_NAME" = "v*" ]]; then
tag=latest
fi
echo "$tag"
tasks:
base:release:
desc: "Весь процесс борки и выпуска"
cmds:
- task: base:info
- task: base:npm:auth
- task: base:npm:audit
- task: base:npm:install
- task: base:npm:build
- task: base:npm:version
- task: base:npm:unpublish
- task: base:npm:publish
base:info:
desc: "Информация"
cmds:
- echo "GITHUB_REF_NAME=$GITHUB_REF_NAME"
- echo "NPM_TAG=$NPM_TAG"
- echo "PWD=$PWD"
base:npm:auth:
desc: "Настройка аутентификации в npm registry"
cmds:
- echo "$NPM_CONFIG_REGISTRY_AUTH" >> .npmrc
- cat .npmrc
base:npm:audit:
desc: "Аудит проекта на безопасность"
cmds:
- npm audit --audit-level critical
base:npm:install:
desc: "Установка зависимостей"
cmds:
- npm ci --prefer-offline --no-audit --no-fund --no-update-notifier --ignore-scripts
base:npm:build:
desc: "Сборка"
cmds:
- npm run build
base:npm:version:
desc: "Корректировка версии c учётом npm тега"
if: '[ "$NPM_TAG" != "latest" ]'
cmd: |
echo "[INFO] Тег npm пакета: $NPM_TAG"
version=$(npm pkg get version | tr -d '"')
version="$version-$NPM_TAG"
npm pkg set "version=$version"
echo "[INFO] Задана версия пакета: $version"
base:npm:unpublish:
desc: "Удаление текущей версии пакета c учётом npm тега"
if: '[ "$NPM_TAG" != "latest" ]'
cmd: |
name=$(npm pkg get name | tr -d '"')
version=$(npm pkg get version | tr -d '"')
#npm dist-tag rm "$name" "$NPM_TAG" || true
npm unpublish "$name@$version" --force || true
base:npm:publish:
desc: "Публикация"
cmd: |
npm publish --tag "$NPM_TAG" --verbose