📦 Run the build command #105
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
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout the repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 1 | |
| - name: Enable corepack | |
| run: | | |
| corepack enable | |
| - name: Setup the latest Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| cache: pnpm | |
| node-version: latest | |
| - name: Install packages | |
| run: | | |
| pnpm i | |
| - name: Build | |
| run: | | |
| npm run build | |
| - env: | |
| GH_TOKEN: ${{ github.token }} | |
| name: Commit and push if necessary | |
| run: | | |
| git add -N . | |
| git diff --name-only -z | while read -d $'\0' -r name; do | |
| content=$(base64 -i "$name") | |
| echo "${content//$'\n'/}" > /tmp/content.txt | |
| escaped=${name//%/%25} | |
| escaped=${escaped//$'\r'/%0D} | |
| escaped=${escaped//$'\n'/%0A} | |
| echo "::group::Put $escaped" | |
| gh api \ | |
| --field branch=main \ | |
| --field content=@/tmp/content.txt \ | |
| --field message=":package: Build $name" \ | |
| --field sha=$(git rev-parse "main:$name") \ | |
| --method PUT \ | |
| "/repos/{owner}/{repo}/contents/$name" | |
| echo ::endgroup :: | |
| rm -f /tmp/content.txt | |
| done | |
| shell: bash | |
| name: Build | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags-ignore: | |
| - '**' |