Publish docs #2
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: publish | |
on: | |
push: | |
branches: [ master ] | |
# tags: [ "v[0-9]+.[0-9]+.[0-9]+" ] | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
cache: npm | |
registry-url: "https://registry.npmjs.org" | |
- name: Configure git user | |
run: | | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config user.name "github-actions[bot]" | |
- run: npm ci | |
- run: npm run build | |
- run: npm run docs | |
- run: npm test | |
# - name: Publish package | |
# working-directory: ./lib | |
# run: npm publish | |
# env: | |
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Publish docs | |
run: | | |
set -x | |
mv ./docs /tmp/docs | |
git reset HEAD --hard | |
git fetch origin ghpages:ghpages | |
git checkout ghpages | |
git rm -rf --ignore-unmatch . | |
git clean -fxd | |
cp -R /tmp/docs/. . | |
git add . | |
! git diff --staged --quiet --exit-code || exit 0 | |
git commit -m "Updated docs (${GITHUB_SHA::7})" | |
git push origin ghpages | |
- name: Create release draft | |
run: gh release create ${{ github.ref_name }} --generate-notes --draft | |
env: | |
GH_TOKEN: ${{ github.token }} |