Skip to content

Commit

Permalink
ci: add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
phphe committed Mar 6, 2024
1 parent c685093 commit 16f6167
Showing 1 changed file with 68 additions and 63 deletions.
131 changes: 68 additions & 63 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,68 @@
# name: Release with Changelog, Build Demo, Deploy to Github Pages, Publish to NPM
# # concat workflows because it is not easy to run trigger multiple. https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow
# permissions:
# contents: write
# on:
# push:
# tags:
# - "v*"

# jobs:
# build:
# runs-on: ubuntu-latest

# steps:
# - name: Checkout Repository
# uses: actions/checkout@v4
# with:
# fetch-depth: 0

# - name: Set up Node.js
# uses: actions/setup-node@v4
# with:
# node-version: "20.x"
# registry-url: "https://registry.npmjs.org"

# - name: Install
# run: npm install

# - name: Release with Changelog
# run: npx changelogithub # or changelogithub@0.12 if ensure the stable result
# continue-on-error: true # failed when only tag pushed
# env:
# GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

# - name: Build Demo
# run: npm run build:web

# - name: Extra Files
# run: |
# # Switch to the generated directory
# cd dist

# # Set custom domain for GitHub Pages
# # echo "youdomain.com" > CNAME

# # Required to bypass Jekyll on GitHub Pages
# echo "" > .nojekyll

# - name: Deploy
# uses: JamesIves/github-pages-deploy-action@v4
# with:
# single-commit: true
# branch: gh-pages
# clean: true
# folder: dist
# - name: Remove Dist
# run: rm -rf dist
# - name: Build Library
# run: npm run build
# - run: rm -rf node_modules && npm ci
# - run: npm publish
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
name: Release with Changelog, Build Docs, Deploy to Github Pages, Publish to NPM
# concat workflows because it is not easy to run trigger multiple. https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow
permissions:
contents: write
on:
push:
tags:
- "v*"

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"

- name: Install
run: npm install

- name: Release with Changelog
run: npx changelogithub # or changelogithub@0.12 if ensure the stable result
continue-on-error: true # failed when only tag pushed
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Build Demo
run: npm run build:web
- name: Build Docs
run: npm run docs:build

- name: Extra Files
run: |
# Switch to the generated directory
cd docs/.vitepress/dist
# cp demo to here
cp ../../../dist v1-demo-windowed
# Set custom domain for GitHub Pages
echo "he-tree-react.phphe.com" > CNAME
# Required to bypass Jekyll on GitHub Pages
echo "" > .nojekyll
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
single-commit: true
branch: gh-pages
clean: true
folder: dist
- name: Remove Dist
run: rm -rf dist
- name: Build Library
run: npm run build
- run: rm -rf node_modules && npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit 16f6167

Please sign in to comment.