Skip to content

Publish package

Publish package #4

Workflow file for this run

name: Publish package
on:
workflow_dispatch:
push:
branches:
- development
paths-ignore:
- 'package.json'
- 'package-lock.json'
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 20.11.0 ]
steps:
- uses: actions/checkout@v3
with:
token: "${{ secrets.AUTH_TOKEN }}"
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Versioning #Dummy versioning
run: npm version patch --no-git-tag-version
- name: Import bot's GPG key for signing commits
id: import-gpg
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_BOT_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_BOT_PASSPHRASE }}
git_config_global: true
git_user_signingkey: true
git_commit_gpgsign: true
- name: Commit update
id: commitPush
continue-on-error: false
env:
GITHUB_TOKEN: ${{ secrets.AUTH_TOKEN }}
GIT_AUTHOR_NAME: ${{ steps.import-gpg.outputs.name }}
GIT_AUTHOR_EMAIL: ${{ steps.import-gpg.outputs.email }}
GIT_COMMITTER_NAME: ${{ steps.import-gpg.outputs.name }}
GIT_COMMITTER_EMAIL: ${{ steps.import-gpg.outputs.email }}
run: |
if [[ $(git status --porcelain | wc -l) -gt 0 ]]; then
echo "New files detected, committing and pushing them"
git add package.json
git commit -S -m "Bump package version"
git push -f
else
echo "No new files, exiting cleanly"
fi
- name: Publish Image
run: |
npm install
npm run build
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}