Publish package to NPM #28
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish package to NPM | |
on: | |
release: | |
types: [created] | |
jobs: | |
build: | |
name: Publish to NPM | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code from repository | |
uses: actions/checkout@v2 | |
with: | |
ref: main | |
# with: | |
# # pulls all commits (needed for lerna / semantic release to correctly version) | |
# fetch-depth: "0" | |
# # Setup .npmrc file to publish to npm | |
# - name: Setup Nodejs 16 | |
# uses: actions/setup-node@v2 | |
# with: | |
# node-version: "16.x" | |
# registry-url: "https://registry.npmjs.org" | |
# - name: Restore lerna | |
# id: cache-modules | |
# uses: actions/cache@v2 | |
# with: | |
# path: | | |
# node_modules | |
# */*/node_modules | |
# key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
# - name: Yarn Install | |
# if: steps.cache-modules.outputs.cache-hit != 'true' | |
# run: | | |
# yarn install | |
# - name: Git Identity | |
# run: | | |
# git config --global user.name 'github-actions[bot]' | |
# git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
# git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/$GITHUB_REPOSITORY | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# - name: Set Current Version | |
# run: | | |
# CURRENT_VERSION=${{ github.event.release.tag_name }} | |
# echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV | |
# echo ${{ env.CURRENT_VERSION }} | |
# - name: Tag Check | |
# id: tag_check | |
# run: | | |
# GET_API_URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/git/ref/tags/v${CURRENT_VERSION}" | |
# http_status_code=$(curl -LI $GET_API_URL -o /dev/null -w '%{http_code}\n' -s \ | |
# -H "Authorization: token ${GITHUB_TOKEN}") | |
# if [ "$http_status_code" -ne "404" ] ; then | |
# echo "::set-output name=exists_tag::true" | |
# else | |
# echo "::set-output name=exists_tag::false" | |
# fi | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# # - name: Create Git Tag | |
# # if: steps.tag_check.outputs.exists_tag == 'false' | |
# # uses: pkgdeps/git-tag-action@v2 | |
# # with: | |
# # version: ${{ env.CURRENT_VERSION }} | |
# # github_token: ${{ secrets.GITHUB_TOKEN }} | |
# # github_repo: ${{ github.repository }} | |
# # git_commit_sha: ${{ github.sha }} | |
# # git_tag_prefix: "v" | |
# # - name: Create Release | |
# # id: create_release | |
# # if: steps.tag_check.outputs.exists_tag == 'false' && github.event.pull_request.merged == true | |
# # uses: actions/create-release@v1 | |
# # env: | |
# # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# # with: | |
# # tag_name: v${{ env.CURRENT_VERSION }} | |
# # # Copy Pull Request's tile and body to Release Note | |
# # release_name: ${{ github.event.pull_request.title }} | |
# # body: | | |
# # ${{ github.event.pull_request.body }} | |
# # draft: false | |
# # prerelease: false | |
- name: Build and Publish | |
# if: steps.tag_check.outputs.exists_tag == 'false' | |
run: | | |
npm whoami | |
npm i --no-save | |
lerna publish ${{ env.CURRENT_VERSION }} --force-publish --no-git-tag-version --yes | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |