Skip to content

Commit

Permalink
Publish on tag (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gnuk authored Jul 15, 2022
1 parent cd2bb39 commit 7064f49
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 5 deletions.
27 changes: 25 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
node-version: [16.x]
steps:
- run: git config --global core.autocrlf false
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: node check
Expand All @@ -22,3 +22,26 @@ jobs:
npm run eslint:ci
npm run test:ci
npm run build
deploy:
if: startsWith(github.event.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: 'https://registry.npmjs.org'
- name: deploy
run: |
PACKAGE_VERSION=$(cat package.json|grep version|head -1|awk -F: '{ print $2 }'|sed 's/[", ]//g')
echo "Package: $PACKAGE_VERSION"
echo "Tag: $GITHUB_REF_NAME"
if [ "$PACKAGE_VERSION" != "$GITHUB_REF_NAME" ]; then echo "$PACKAGE_VERSION and $GITHUB_REF_NAME are not the same, skipping"; exit 0; fi
echo "Publishing $PACKAGE_VERSION …"
npm ci
npm run build
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ This is a basic command to generate dojo from template.
npm i -g katadojo
```

## Usage

To know how to use, please launch:

```shell
katadojo help
```

## Development

Run tests with:
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"name": "katadojo",
"version": "2.0.0",
"version": "2.0.1",
"description": "Kata generator",
"main": "index.js",
"repository": "github:Gnuk/katadojo",
"homepage": "https://github.com/Gnuk/katadojo#readme",
"scripts": {
"eslint": "eslint \"./**/*.{ts,js}\" --fix",
"eslint:ci": "eslint \"./**/*.{ts,js}\"",
Expand Down

0 comments on commit 7064f49

Please sign in to comment.