Skip to content

Commit

Permalink
- Publish npm from release branch
Browse files Browse the repository at this point in the history
- Consolidate action into single file
  • Loading branch information
niwsa committed Apr 8, 2023
1 parent b6226dc commit bf695d7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 34 deletions.
27 changes: 18 additions & 9 deletions .github/workflows/npm-publish.yml → .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@
name: Node.js Package

on:
release:
types: [created]
push:
branches:
- main
- release
tags:
- "beta-v*"
pull_request:
# Trigger only for PRs that target main branch
branches:
- main

jobs:
build:
Expand Down Expand Up @@ -34,21 +42,22 @@ jobs:
npm install -g json
JACKSON_VERSION=$(echo $(cat package.json) | json version)
# publishTag="latest"
publishTag="latest"
# if [[ "$GITHUB_REF" == *\/release ]]
# then
# echo "Release branch"
# else
echo "Beta release"
if [[ "$GITHUB_REF" == *\/release ]]
then
echo "Release branch"
else
echo "Dev branch"
publishTag="beta"
JACKSON_VERSION="${JACKSON_VERSION}-beta.${GITHUB_RUN_NUMBER}"
# fi
fi
json -I -f package.json -e "this.version=\"${JACKSON_VERSION}\""
echo "NPM_VERSION=${JACKSON_VERSION}" >> $GITHUB_OUTPUT
echo "PUBLISH_TAG=${publishTag}" >> $GITHUB_OUTPUT
- run: npm publish --tag ${{ steps.version.outputs.PUBLISH_TAG }} --access public
if: github.ref == 'refs/heads/release' || contains(github.ref, 'refs/tags/beta-v')
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
25 changes: 0 additions & 25 deletions .github/workflows/node.js.yml

This file was deleted.

0 comments on commit bf695d7

Please sign in to comment.