Skip to content

Commit

Permalink
fix ci release (#347) (#349)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben-Rey authored Jun 23, 2023
1 parent 00d49a2 commit 3a61a3e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
4 changes: 2 additions & 2 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 3a61a3e

Please sign in to comment.