Skip to content

Commit

Permalink
feat: github workflow push version
Browse files Browse the repository at this point in the history
  • Loading branch information
avil13 committed Oct 25, 2020
1 parent 4b0bc73 commit 2f528c1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/npmpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,8 @@ jobs:
node-version: 12
registry-url: https://registry.npmjs.org/
# Проверяем изменилась ли версия
- name: Set CURRENT VERSION to ENV
run: echo ::set-env name=CURRENT_VERSION::$(node -p -e "require('./package.json').version")

- name: Set PUBLIC VERSION to ENV
run: echo ::set-env name=PUBLIC_VERSION::$(npm show vue-sweetalert2 version)

- name: Set NEED_PUBLISH
run: echo ::set-env name=NEED_PUBLISH::$([[ "$CURRENT_VERSION"!="$PUBLIC_VERSION" ]] && echo '1' || echo '')
run: echo ::set-env name=NEED_PUBLISH::$(./need-publish.sh)

- run: yarn
if: ${{ env.NEED_PUBLISH }}
Expand Down
13 changes: 13 additions & 0 deletions packages/vue-sweetalert2/need-publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

PKG=$(node -p -e "require('./package.json').name")

# we get the version of the package in a branch
CURRENT_VERSION=$(node -p -e "require('./package.json').version")
PUBLIC_VERSION=$(npm show ${PKG} version)


if [[ $CURRENT_VERSION != $PUBLIC_VERSION ]];
then
echo 'TRUE';
fi

0 comments on commit 2f528c1

Please sign in to comment.