Create release without Changelog if changelog does not exist #1350
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: Generate Docs | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
generate-docs: | |
if: github.run_number != 1 && github.event.repository.owner.login == 'react18-tools' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
ref: ${{ github.event.before }} | |
- name: Check if package.json was modified | |
id: pub | |
run: | | |
git fetch origin main && git checkout main | |
if git diff --name-only ${{ github.event.before }} HEAD | grep -q "lib/package.json"; then | |
echo "file_changed=true" >> $GITHUB_ENV | |
else | |
echo "file_changed=false" >> $GITHUB_ENV | |
fi | |
- name: Exit early if lib/package.json was modified | |
if: env.file_changed == 'true' | |
run: exit 1 | |
- uses: actions/setup-node@v4 | |
with: | |
registry-url: https://registry.npmjs.org | |
node-version: 20 | |
- name: Setup Git | |
run: | | |
git config --global user.name "mayank1513" | |
git config --global user.email "[email protected]" | |
git fetch | |
git checkout main | |
git pull | |
- run: npm i -g pnpm && pnpm i --no-frozen-lockfile | |
name: Install dependencies | |
- run: git stash --include-untracked | |
name: clean up working directory | |
- name: Generate/update docs | |
run: pnpm doc | |
- name: Save docs back to repo | |
run: git add . && git commit -m "upgrade deps && docs [skip ci]" && git push origin main | |
- name: Update website | |
continue-on-error: true | |
run: | | |
gh api \ | |
--method POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
/repos/mayank1513/turborepo-template/merge-upstream \ | |
-f "branch=main" | |
env: | |
GH_TOKEN: ${{ secrets.mayank1513PAT }} |