Skip to content

ci: update workflows config. #45

ci: update workflows config.

ci: update workflows config. #45

Workflow file for this run

name: Build & Test
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- run: npm install
- run: npm run build
- run: npm run test
- run: npm i markdown-to-html-cli -g
- run: markdown-to-html --output coverage/index.html --github-corners https://github.com/uiwjs/date-formatter
- name: Create Tag
id: create_tag
uses: jaywcjlove/create-tag-action@main
with:
package-path: ./package.json
- name: get tag version
id: tag_version
uses: jaywcjlove/changelog-generator@main
- run: |
cat > coverage/README.md << EOF
[![Demo preview in CodePen](https://shields.io/badge/Demo%20Open%20in-CodePen-success?logo=codepen&style=flat)](https://codepen.io/jaywcjlove/pen/zbZKmq)
[![Demo preview in CodeSandbox](https://shields.io/badge/Demo%20Open%20in-CodeSandbox-success?logo=codesandbox&style=flat)](https://codesandbox.io/s/date-formatter-demo-jib1u)
```bash
$ npm install --save @uiw/formatter
```
Documentation ${{ steps.tag_version.outputs.tag }}: https://raw.githack.com/uiwjs/date-formatter/${{ steps.tag_version.outputs.gh-pages-short-hash }}/index.html
Documentation Website: https://uiwjs.github.io/date-formatter/
EOF
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
commit_message: ${{steps.tag_version.outputs.tag}} ${{ github.event.head_commit.message }}
github_token: ${{ secrets.GITHUB_TOKEN }}
exclude_assets: 'coverage-final.json,lcov.info,clover.xml'
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
publish_dir: ./coverage
- name: Generate Changelog
id: changelog
uses: jaywcjlove/changelog-generator@main
with:
head-ref: ${{steps.create_tag.outputs.version}}
filter: '[R|r]elease[d]\s+[v|V]\d(\.\d+){0,2}'
- name: Create Release
uses: ncipollo/release-action@v1
if: steps.create_tag.outputs.successful
with:
allowUpdates: true
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ steps.changelog.outputs.tag }}
tag: ${{ steps.changelog.outputs.tag }}
body: |
[![](https://img.shields.io/badge/Open%20in-unpkg-blue)](https://uiwjs.github.io/npm-unpkg/#/@uiw/formatter@${{steps.create_tag.outputs.versionNumber}}/file/README.md)
Documentation ${{ steps.changelog.outputs.tag }}: https://raw.githack.com/uiwjs/formatter/${{ steps.changelog.outputs.gh-pages-short-hash }}/index.html
Comparing Changes: ${{ steps.changelog.outputs.compareurl }}
${{ steps.changelog.outputs.changelog }}
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# - uses: JS-DevTools/npm-publish@v1
# with:
# token: ${{ secrets.NPM_TOKEN }}
- name: package.json info
uses: jaywcjlove/github-action-package@main
with:
unset: scripts,devDependencies
- run: npm publish
name: 📦 @uiw/formatter publish to NPM
continue-on-error: true
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}