Update publish.yml #52
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 | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
release: | |
name: Create Release and Publish to npm | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '22' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Set up pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 9 | |
- name: Install dependencies | |
run: pnpm install | |
- name: Test | |
run: pnpm run test:ci | |
- name: Run semantic-release | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: npx semantic-release | |
# Additional steps to build and publish the documentation | |
- name: Build documentation | |
run: pnpm run docs:build # Ensure this command correctly generates the static files | |
- name: Checkout documentation repo | |
uses: actions/checkout@v3 | |
with: | |
repository: holy-sheets/holy-sheets.github.io | |
token: ${{ secrets.DOCS_GH_TOKEN }} | |
path: docs-site # Directory where the repository will be cloned | |
- name: Copy generated docs to docs repo | |
run: | | |
rm -rf docs-site/* # Remove old files | |
cp -R docs/.vitepress/dist/* docs-site/ # Adjust the path according to your build structure | |
- name: Commit and Push changes | |
run: | | |
cd docs-site | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git add . | |
git commit -m "docs: update site from main repo" || echo "No changes to commit" | |
git push origin main # Push to the main branch | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} |