From 033019eadff0358fd99dd56e905052094bed767c Mon Sep 17 00:00:00 2001 From: selmi-karim Date: Sat, 30 May 2020 16:14:33 +0100 Subject: [PATCH] fix: publish to gpr --- .github/workflows/build.yml | 42 ----------------------------------- .github/workflows/release.yml | 17 ++++++++++++++ 2 files changed, 17 insertions(+), 42 deletions(-) delete mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 77d0db1..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: build -# This workflow is triggered on pushes to the repository. -on: - push: - branches: - - master - - develop -jobs: - build: - # Job name is Greeting - name: Build - # This job runs on Linux - runs-on: ubuntu-latest - steps: - # This step uses GitHub's hello-world-javascript-action: https://github.com/actions/hello-world-javascript-action - - name: Checkout - uses: actions/checkout@v1 - - name: install node js - uses: actions/setup-node@v1 - with: - node-version: 12 - registry-url: https://npm.pkg.github.com/ - scope: "@selmi-karim" - - name: NPM install - run: npm install - - name: Publish to GPR - env: - COMMIT_FILTER: "chore(release)" - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} - run: | - # Get last commit message - readonly local last_commit_log=$(git log -1 --pretty=format:"%s") - echo "last commit log: $last_commit_log" - readonly local filter_count=$(echo "$last_commit_log" | grep -c "$COMMIT_FILTER" ) - echo "number of occurence of '$COMMIT_FILTER' in '$last_commit_log': $filter_count" - if [[ "$filter_count" -eq 0 ]]; then - echo "no need to publish new version to GPR" - else - echo "GPR should be updated" - npm publish - fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a7bd5d6..e598eb6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,3 +27,20 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: npx -p @semantic-release/changelog -p @semantic-release/git -p semantic-release semantic-release + - name: Publish to GPR + env: + COMMIT_FILTER: "chore(release)" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} + run: | + # Get last commit message + readonly local last_commit_log=$(git log -1 --pretty=format:"%s") + echo "last commit log: $last_commit_log" + readonly local filter_count=$(echo "$last_commit_log" | grep -c "$COMMIT_FILTER" ) + echo "number of occurence of '$COMMIT_FILTER' in '$last_commit_log': $filter_count" + if [[ "$filter_count" -eq 0 ]]; then + echo "no need to publish new version to GPR" + else + echo "GPR should be updated" + npm publish + fi