chore: update package manager to pnpm@10.20.0 and modify GitHub Actio… #53
This file contains hidden or 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
| # https://gist.github.com/KermanX/27461e8694f5d5b00c3817dbed15f39f | |
| name: Export | |
| on: | |
| push: | |
| branches: [main] | |
| # pull_request: | |
| # branches: | |
| # - main | |
| workflow_dispatch: | |
| jobs: | |
| export: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 'lts/*' | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: latest | |
| # Cache node_modules | |
| - name: Cache node modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| node_modules | |
| **/node_modules | |
| ~/.pnpm-store | |
| key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Install playwright browsers | |
| run: pnpm exec playwright install chromium --with-deps | |
| - name: Create Export Directory | |
| run: mkdir -p ./_export | |
| - name: Export | |
| run: | | |
| pnpm exec slidev export -- --format pdf --output ./_export/javascript-note.pdf | |
| # pnpm exec slidev export -- --format pptx --output ./_export/javascript-note.pptx | |
| - name: Generate Body | |
| run: | | |
| echo -e "## Welcome to the resource download section\n### Please download the class note in PDF or PPTX (just pictures in png) files from the assets section below"\n Best of Luck and may the fourth be with you. > ./_export/body.txt | |
| # Disable Git hooks before the action | |
| - name: Disable pre-push hook | |
| run: mv .git/hooks/pre-push .git/hooks/pre-push.bak || true | |
| - name: Create Tag | |
| uses: rickstaa/action-create-tag@v1.7.2 | |
| with: | |
| tag: export-${{ github.sha }} | |
| - name: Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: Exports for ${{ github.sha }} | |
| body_path: ./_export/body.txt | |
| tag_name: export-${{ github.sha }} | |
| make_latest: true | |
| files: | | |
| ./_export/javascript-note.pdf | |
| ./_export/javascript-note.pptx | |
| # Re-enable Git hooks after the action | |
| - name: Re-enable pre-push hook | |
| run: mv .git/hooks/pre-push.bak .git/hooks/pre-push || true |