Skip to content

Implement Github action to publish on npmjs #2

Implement Github action to publish on npmjs

Implement Github action to publish on npmjs #2

name: Adobe reusable workflows - Publish to npmjs
on:
workflow_call:
secrets:
auth-token:
required: true
jobs:
publish:
name: Publish packages
runs-on: ubuntu-latest
steps:
- name: Fetch build-cache
uses: actions/cache@v3
id: build-cache
with:
path: |
./*
!./node_modules
key: build-cache-${{ github.sha }}
- name: Publish to registry
shell: bash
run: |
OPTS=();
if [[ $(npm pkg get version) == *"-"* ]]; then OPTS+=('--tag=next') ; fi
if [[ $(npm pkg get workspaces) != "{}" ]]; then OPTS+=('--workspaces') ; fi
npm publish $OPTS --access=public
env:
NODE_AUTH_TOKEN: ${{ secrets.auth-token }}
<<<<<<< HEAD

Check failure on line 33 in .github/workflows/reusable-workflow-publish.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/reusable-workflow-publish.yml

Invalid workflow file

You have an error in your yaml syntax on line 33
=======
We use `autocrlf` here to fix flow in case this reusable workflow is use after another one run-on windows.
- name: Configure git
shell: bash
run: |
git config --global core.autocrlf false
git config --global user.name "$(git --no-pager log --format=format:'%an' -n 1)"
git config --global user.email "$(git --no-pager log --format=format:'%ae' -n 1)"
- name: Tag commit
shell: bash
run: |
TAG_VERSION=$(npm pkg get version | xargs)
git tag $TAG_VERSION
git push origin $TAG_VERSION
>>>>>>> db161a5... Update