Skip to content

Commit

Permalink
npm version control by tag for workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusJohansen committed Sep 29, 2023
1 parent b78ad56 commit 41a9ed4
Showing 1 changed file with 28 additions and 16 deletions.
44 changes: 28 additions & 16 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,40 @@
name: Publish to npm
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: Node.js Package

on:
release:
types: [created]

jobs:
build:
format-prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm ci
- run: npx prettier . --write

compile-sass:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: npm ci
- name: Build package
run: npm run build
- name: Format code
run: npx prettier . --write
- name: Compile Sass
run: npm install -g sass && sass sass/main.scss css/chimera.css
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm ci
- run: npm install -g sass
- run: sass sass/main.scss css/chimera.css

publish:
needs: build
publish-npm:
needs: [format-prettier, compile-sass]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
Expand All @@ -34,3 +44,5 @@ jobs:
run: npm version ${{ github.event.release.tag_name }}
- name: Publish package
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

0 comments on commit 41a9ed4

Please sign in to comment.