From 3a61a3e7a40fbfac50ff7ace2078a6427a89027b Mon Sep 17 00:00:00 2001 From: Senji888 <44082144+Ben-Rey@users.noreply.github.com> Date: Fri, 23 Jun 2023 16:37:45 +0200 Subject: [PATCH] fix ci release (#347) (#349) --- .github/workflows/npm-publish.yml | 16 ++++++++++------ scripts/publish.sh | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index d19a04ba..44495391 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -13,18 +13,22 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: node-version: 18 registry-url: https://registry.npmjs.org/ - - name: Extract branch from tag - id: branch-from-tag - run: | - branch=$(git branch --contains "${{ github.ref }}" --format="%(refname:lstrip=2)" | head -1) - echo "Branch from tag: $branch" - - run: ./scripts/publish.sh ${{ steps.branch-from-tag.outputs.branch }} + + - name: Extract tag + id: get_tag + run: echo ::set-output name=TAG::${GITHUB_REF#refs/tags/} + env: + GITHUB_REF: ${{ github.ref }} + + - run: ./scripts/publish.sh ${{ steps.get_tag.outputs.TAG }} env: NODE_AUTH_TOKEN: ${{ secrets.npm_token }} + - uses: softprops/action-gh-release@v1 with: files: | diff --git a/scripts/publish.sh b/scripts/publish.sh index d368fe8c..5e4fca33 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -8,9 +8,9 @@ PACKAGE_NAME=$(cat package.json | jq -r '.name') PUBLISH_VERSION=$(cat package.json | jq -r '.version') echo "Publishing ${PACKAGE_NAME}@$PUBLISH_VERSION" -BRANCH=$1 +ref=$1 TAG="" -if [[ "$BRANCH" == "buildnet" ]]; then +if [[ "$ref" == *"buildnet"* ]]; then TAG="--tag buildnet" fi