ci: update workflows config. #30
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build & Deploy | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build-deploy: | |
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 compile | |
- run: npm run compile:min | |
- run: mkdir -p build | |
- run: cp -r reset.* ./build | |
- run: npm i markdown-to-html-cli -g | |
- run: markdown-to-html --output build/doc.html --favicon 'data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>💅</text></svg>' | |
- name: Create Index.html | |
working-directory: build | |
run: | | |
cat > index.html << EOF | |
<!DOCTYPE html><html lang="en"> | |
<head> | |
<title>reset-css</title> | |
<meta name="description" content="A tiny modern CSS reset."> | |
<link rel="stylesheet" type="text/css" href="reset.min.css" /> | |
<style> | |
.docbtn { background: #2196f3; display: inline-block; padding: 5px 12px; color: #fff; border-radius: 2px; transition: all 0.3s; position: fixed; left: 10px; top: 10px; } | |
.docbtn:hover { background: #377eb7; color: #fff; } | |
</style> | |
</head> | |
<body style="text-align: center;"> | |
<a target="__blank" class="docbtn" href="doc.html">Document</a> | |
<a href="https://github.com/uiwjs/reset-css" target="__blank"> | |
<h1 style="font-size: 46px; padding: 50px 0 0 0; font-weight: bold;">reset.css</h1> | |
</a> | |
<p style="padding-bottom: 30px;color: #a5a5a5;">A tiny modern CSS reset.</p> | |
<div> | |
<a href="./reset.css">reset.css</a> | |
</div> | |
<div> | |
<a href="./reset.less">reset.less</a> | |
</div> | |
<div> | |
<a href="./reset.min.css">reset.min.css</a> | |
</div> | |
</body></html> | |
EOF | |
- name: Is a tag created auto? | |
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 | |
- 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 }} | |
publish_dir: ./build | |
- name: Generate Changelog | |
id: changelog | |
uses: jaywcjlove/changelog-generator@main | |
if: steps.create_tag.outputs.successful | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
head-ref: ${{steps.create_tag.outputs.version}} | |
filter-author: (小弟调调™|Renovate Bot) | |
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.create_tag.outputs.version }} | |
tag: ${{ steps.create_tag.outputs.version }} | |
body: | | |
[![](https://img.shields.io/badge/Open%20in-unpkg-blue)](https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/reset.css@${{steps.create_tag.outputs.versionNumber}}/file/README.md) | |
Documentation ${{ steps.changelog.outputs.tag }}: https://raw.githack.com/uiwjs/reset-css/${{ steps.changelog.outputs.gh-pages-short-hash }}/index.html | |
Comparing Changes: ${{ steps.changelog.outputs.compareurl }} | |
```bash | |
npm i @uiw/reset.css@${{steps.create_tag.outputs.versionNumber}} | |
``` | |
${{ steps.changelog.outputs.changelog }} | |
- run: git status | |
- run: npm publish | |
name: 📦 @uiw/reset.css publish to NPM | |
continue-on-error: true | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
# - name: 📦 @uiw/reset.css publish to NPM | |
# uses: JS-DevTools/npm-publish@v1 | |
# with: | |
# token: ${{ secrets.NPM_TOKEN }} | |
# package: ./package.json |