Skip to content

Setup repository

Setup repository #5

Workflow file for this run

name: Setup repository
on: workflow_dispatch
permissions:
pages: read
contents: write
pull-requests: write
jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Pages
id: configure-pages
uses: actions/configure-pages@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- run: |
rm .github/workflows/setup.yaml
rm -r assets/
sed -i 's#--base /slidev-resources-template#--base ${{ steps.configure-pages.outputs.base_path }}#g' package.json
cat <<EOF > README.md
[![Release slidev](https://github.com/${{ github.repository }}/actions/workflows/release.yaml/badge.svg)](https://github.com/${{ github.repository }}/actions/workflows/release.yaml)
# slidev-resources
This repository manage my [slidev](https://sli.dev/) resources.
* [GitHub Pages(SPA)](${{ steps.configure-pages.outputs.base_url }})
* [GitHub Releases(PDF)](https://github.com/${{ github.repository }}/releases)
## Write and deploy a slide
1. Run \`npm install\`
2. Run \`npm run new\` and specify a name of directory (e.g.:\`my-slide\`) to create new sub-project
* \`npm run new\` command will create \`my-slide/slides.md\` and \`my-slide/public/\`
* \`my-slide/slides.md\` is an entry point for slidev. (Filename `slides.md` must not be changed because its name is hardcoded in some scripts in \`package.json\`)
* Static files in \`my-slide/public\` can be refered from slide
* e.g.: \`my-slide/public/image.png\` can be refered as \`/image.png\` from \`my-slide/slides.md\`
3. Commit subdirectory (e.g.: \`my-slide/\`) and create a tag with the name of the directory (e.g.: \`my-slide\`)
### Set up environment to write a slide
This repository has devcontainer setting, so you can create Codespace from [Your Codespaces](https://github.com/${{ github.repository }}/codespaces) and write slidev on it.
There are two kinds of devcontainer.
| Configuration | Description |
|:----------------|:------------|
| [Slidev Dev](./.devcontainer/devcontainer.json) | Use \`mcr.microsoft.com/vscode/devcontainers/universal:2-linux\` |
| [Slidev Dev (ja)](./.devcontainer/slidev-dev-ja) | \`Slidev Dev\` + cjk font (fonts-noto-cjk) |
### Enable OGP on GitHub Pages (Experimental)
Adding \`githubPages.ogp=true\` to frontmatter enables OGP on GitHub Pages.
\`\`\`yaml
githubPages:
ogp: true
\`\`\`
Parameters of OGP are from a front-matter in slidev entry file.
| ogp property | front-matter | default value |
|:---------------|:-------------|:--------------|
| og:title | title | \`Slidev Presentation\` |
| og:type | - | \`website\` |
| og:url | - | \`{url_ghpages}\` |
| og:image | - | \`{url_ghpages}/preview.png\` |
| og:description | info | \`(empty)\` |
Preview image of \`og:image\` is generate from the first page of PDF file.
## When encounting font issue
If your slide encounters font issue, you need to add a step to install your language's font to [the release action](./.github/workflows/release.yaml).
For example (to install Japanese font):
\`\`\`yaml
...
jobs:
release:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Install Japanese font # Insert these 2 lines
run: sudo apt install -y fonts-noto # to install Japanese font
- uses: actions/checkout@v3
...
\`\`\`
# License
This repository is licensed under the MIT License. See [LICENSE](LICENSE) for the full license text.
EOF
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'chore: setup repository'
title: 'chore: setup repository'
body: |
This is an automated pull request to setup the repository.
It will be automatically closed if no commits are made to this branch within 30 days.
branch: setup-repository
branch-suffix: timestamp
delete-branch: true