Skip to content

Commit

Permalink
Merge pull request #21 from vlavrynovych/feature/20
Browse files Browse the repository at this point in the history
#20 Job to publish to npm was added
  • Loading branch information
vlavrynovych authored Nov 11, 2023
2 parents 8cd6ab5 + 5e0851d commit 046d884
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: npm-publish
on:
push:
branches:
- main

jobs:
check:
name: Check Version
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.check.outputs.changed }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Check if version has been updated
id: check
uses: EndBug/version-check@v2

- name: Log when unchanged
if: steps.check.outputs.changed == 'false'
run: 'echo "No version change"'

- name: Log when changed
if: steps.check.outputs.changed == 'true'
run: 'echo "Version change found in commit ${{ steps.check.outputs.commit }}! New version: ${{ steps.check.outputs.version }} (${{ steps.check.outputs.type }})"'
publish:
needs:
- check
if: needs.check.outputs.changed == 'true'
name: Publish
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "16"

- run: npm install
- run: mkdir backups

- run: npm run test:mocha
- run: npm run build

- run: git diff --name-only

- uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_AUTH_TOKEN }}
dry-run: true

0 comments on commit 046d884

Please sign in to comment.