Publish Package to npmjs #141
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 npmjs | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
id-token: write | |
outputs: | |
output1: ${{ steps.step1.outputs.VERSION }} | |
# output2: ${{ steps.step1.outputs.SVG }} | |
defaults: | |
run: | |
working-directory: ./dev-badge-icon | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
# GITHUB_CONTEXT: ${{ toJson(github) }} | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
# Setup .npmrc file to publish to npm | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 'latest' | |
registry-url: 'https://registry.npmjs.org' | |
- run: npm install -g npm@latest | |
- run: npm install --save | |
- name: VERSION | |
id: step1 | |
shell: bash | |
run: | | |
cd ${{ github.workspace }}/dev-badge-icon | |
VERSION=$(npm version patch) | |
echo VERSION=$VERSION | |
echo $VERSION | |
echo "VERSION=$(echo $VERSION)" >> $GITHUB_OUTPUT | |
# SVG=$(find ${{ github.workspace }}/generate-icons/ -name '*.svg' -type f -printf "%f\n") | |
# echo SVG=$SVG | |
# echo $SVG | |
# echo "SVG=$(echo $SVG)" >> $GITHUB_OUTPUT | |
- run: npm ci | |
- run: npm publish | |
- run: npm version ${{ github.event.release.tag_name }} | |
- run: echo "$GITHUB_CONTEXT" | |
- run: sleep 2m | |
- run: npm run version | |
- name: Update | |
shell: bash | |
run: | | |
git config --global user.email ${{ secrets.EMAIL }} | |
git config --global user.name ${{ secrets.NAME }} | |
# rm -fv ${{ github.workspace }}/generate-icons/icons/*.svg | |
git add -A | |
# echo ${{ steps.step1.outputs.SVG }} | |
echo ${{ steps.step1.outputs.VERSION }} | |
git commit -m "${{ steps.step1.outputs.VERSION}}" | |
git status | |
git push |