-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (53 loc) · 1.44 KB
/
build.yml
File metadata and controls
53 lines (53 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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:
- '**'