Skip to content

Commit 2222624

Browse files
authored
Update build.yml
1 parent 4bf09b8 commit 2222624

File tree

1 file changed

+61
-2
lines changed

1 file changed

+61
-2
lines changed

.github/workflows/build.yml

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,61 @@ env:
1919
LDFLAGS: "-static-pie -static"
2020

2121
jobs:
22+
fetch-submodules:
23+
name: Fetch submodules
24+
runs-on: ubuntu-latest
25+
26+
container:
27+
image: alpine:latest
28+
volumes:
29+
- /:/host
30+
- /tmp/node20:/__e/node20
31+
32+
steps:
33+
- name: Patch Alpine for GitHub Actions
34+
run: |
35+
apk add --no-cache nodejs npm gcompat git
36+
sed -i 's/^ID=.*/ID=gha/' /etc/os-release
37+
mkdir -p /__e/node20/bin
38+
ln -sf /usr/bin/node /__e/node20/bin/node
39+
ln -sf /usr/bin/npm /__e/node20/bin/npm
40+
41+
- uses: actions/checkout@v4
42+
with:
43+
fetch-depth: 0
44+
45+
- name: Restore submodules cache
46+
id: cache-submodules
47+
uses: actions/cache/restore@v4
48+
with:
49+
path: .git/modules
50+
key: submodules-${{ hashFiles('.gitmodules') }}
51+
52+
- name: Fetch submodules
53+
run: |
54+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
55+
git submodule update --init --recursive
56+
57+
- name: Save submodules cache
58+
if: steps.cache-submodules.outputs.cache-hit != 'true'
59+
uses: actions/cache/save@v4
60+
with:
61+
path: .git/modules
62+
key: submodules-${{ hashFiles('.gitmodules') }}
63+
64+
- name: Create submodules tarball
65+
run: |
66+
tar -czf submodules.tar.gz .git/modules
67+
68+
- uses: actions/upload-artifact@v4
69+
with:
70+
name: submodules
71+
path: submodules.tar.gz
72+
retention-days: 1
73+
2274
build:
2375
name: ${{ matrix.arch }}
76+
needs: fetch-submodules
2477
runs-on: ubuntu-latest
2578

2679
container:
@@ -47,9 +100,14 @@ jobs:
47100
with:
48101
fetch-depth: 0
49102

50-
- name: Fetch submodules
103+
- uses: actions/download-artifact@v4
104+
with:
105+
name: submodules
106+
107+
- name: Restore submodules
51108
run: |
52109
git config --global --add safe.directory "$GITHUB_WORKSPACE"
110+
tar -xzf submodules.tar.gz
53111
git submodule update --init --recursive
54112
55113
- name: Install LLVM toolchain
@@ -72,7 +130,7 @@ jobs:
72130
TARGET: ${{ matrix.arch }}-alpine-linux-musl
73131
run: |
74132
set -e
75-
./cbuild.sh fetch
133+
./cbuild.sh clean
76134
./cbuild.sh
77135
78136
mkdir -p dist
@@ -98,6 +156,7 @@ jobs:
98156
- uses: actions/download-artifact@v4
99157
with:
100158
path: artifacts
159+
pattern: baseutils-*
101160
merge-multiple: true
102161

103162
- name: Update continuous release

0 commit comments

Comments
 (0)