feat: readme #9
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 and publish on branch | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Nodejs | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: "yarn" | |
- name: Install dependencies | |
run: yarn install | |
# Cache build during CI: https://nextjs.org/docs/pages/building-your-application/deploying/ci-build-caching#github-actions | |
- name: Cache Next build | |
uses: actions/cache@v4 | |
with: | |
# See here for caching with `yarn` https://github.com/actions/cache/blob/main/examples.md#node---yarn or you can leverage caching with actions/setup-node https://github.com/actions/setup-node | |
path: | | |
${{ github.workspace }}/.next/cache | |
# Generate a new cache whenever packages or source files change. | |
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }} | |
# If source files changed but packages didn't, rebuild from a prior cache. | |
restore-keys: | | |
${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}- | |
- name: Build | |
run: CI=false yarn build # Using CI=false remove Treat warning as error that make the compilation fail | |
- name: Prepare build | |
run: | | |
mkdir module_build | |
cp -r out module_build/out | |
cp -r pyproject.toml module_build/pyproject.toml | |
cp -r python module_build/python | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v4 | |
if: github.ref == 'refs/heads/main' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./module_build | |
publish_branch: build | |
commit_message: ${{ github.event.head_commit.message }} |