Skip to content

Commit

Permalink
moved 2 workflows to one
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Duda committed Apr 11, 2024
1 parent 223e529 commit 3ed0904
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 84 deletions.
56 changes: 0 additions & 56 deletions .github/workflows/publish-package-to-npm.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/run-unit-tests.yml

This file was deleted.

53 changes: 53 additions & 0 deletions .github/workflows/test-and-deploy-to-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Run tests and deploy to NPM automatically
on: [push]
run-name: ${{ github.event.head_commit.message }}
jobs:

run-tests:

runs-on: ubuntu-latest
defaults:
run:
working-directory: ./
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-node@v3
with:
node-version: '12.16.1'
- name: Install npm dependencies
run: npm install --no-package-lock
- name: Create scope-tags build
run: npx tsc
# Just to not display git warning in unit test output
- name: Configure git
run: git config --global init.defaultBranch main
- name: Make temporary folder for tests
run: mkdir ./__testModulesData__ && sleep 5
- name: Run Jest unit tests
run: npm run test

publish:

name: Publish
needs: run-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache node_modules
id: cache-modules
uses: actions/cache@v1
with:
path: node_modules
key: 12.x-${{ runner.OS }}-build-${{ hashFiles('package.json') }}
- name: Build
if: steps.cache-modules.outputs.cache-hit != 'true'
run: npm install --no-package-lock
- name: Publish
uses: mikeal/merge-release@master
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
DEPLOY_DIR: my/deploy/dir
SRC_PACKAGE_DIR: my/src/package
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![npm version](https://badge.fury.io/js/scope-tags.svg)](https://www.npmjs.com/package/scope-tags)
![unit tests](https://github.com/matiduda/scope-tags/actions/workflows/run-unit-tests.yml/badge.svg)
![Auto test and deploy](https://github.com/matiduda/scope-tags/actions/workflows/test-and-deploy-to-npm.yml/badge.svg)

### How to install

Expand Down

0 comments on commit 3ed0904

Please sign in to comment.