-
Notifications
You must be signed in to change notification settings - Fork 3
184 lines (158 loc) Β· 6.04 KB
/
custom.yml
File metadata and controls
184 lines (158 loc) Β· 6.04 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
name: Node.js custom build job
on:
workflow_dispatch:
inputs:
version:
description: 'Node.js version'
required: true
default: 'v25.0.0'
latest_version:
description: 'Latest'
type: boolean
required: true
default: false
jobs:
build-custom:
name: Build Node.js ${{ github.event.inputs.version }} ${{ matrix.binaries }}
runs-on: ubuntu-latest
env:
version: ${{ github.event.inputs.version }}
latest_version: ${{ github.event.inputs.latest_version }}
strategy:
matrix:
name: ['node']
binaries: ['gnu', 'musl']
outputs:
create: ${{ steps.check_release.outputs.create }}
steps:
- name: Check version
run: |
echo "Node.js current version: ${version}, latest: ${latest_version}"
major_version=$(echo $version | sed 's/^v//' | cut -d '.' -f 1)
echo "major_version=${major_version}" >> $GITHUB_ENV
- name: Check release
id: check_release
run: |
gh release view ${{ env.version }} -R ${{ github.repository }} | grep SHASUMS256.txt.asc >/dev/null 2>&1 || create=1
echo "create=${create:-0}" >> $GITHUB_ENV
echo "create=${create:-0}" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v5
if: env.create == '1'
with:
path: main
- name: Create tag
if: env.create == '1'
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git tag ${{ env.version }} || true
git push origin ${{ env.version }} --force
working-directory: main
- uses: actions/checkout@v5
if: env.create == '1'
with:
repository: loong64/node-unofficial-builds
path: unofficial-builds
- uses: docker/setup-qemu-action@v3
if: env.create == '1'
- uses: docker/setup-buildx-action@v3
if: env.create == '1'
- name: Restore Cache
if: env.create == '1'
id: cache-restore
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}/workdir/.ccache
key: ${{ matrix.name }}-${{ matrix.binaries }}-v${{ env.major_version }}-
- name: Set Cache
if: env.create == '1'
run: |
mkdir -p ${{ github.workspace }}/workdir/staging
sudo chmod -R 777 ${{ github.workspace }}/workdir/staging
sudo chown -R 1000:docker ${{ github.workspace }}/workdir/staging
- name: Build node.js
if: env.create == '1'
run: |
if [ "${{ env.major_version }}" -ge "24" ]; then
sed -i 's@stable@mainline@g' recipes/loong64-${{ matrix.binaries }}/Dockerfile
fi
./bin/local_build.sh -r loong64-${{ matrix.binaries }} -v ${{ env.version }} -w ${{ github.workspace }}/workdir
mkdir -p ${{ github.workspace }}/dist
cp -f ${{ github.workspace }}/workdir/staging/release/${{ env.version }}/* ${{ github.workspace }}/dist/
if [ ${{ matrix.binaries }} = "gnu" ]; then
cp -f ${{ github.workspace }}/workdir/staging/src/${{ env.version }}/* ${{ github.workspace }}/dist/
fi
working-directory: unofficial-builds
- name: Save Cache
if: always() && env.create == '1'
id: cache-save
uses: actions/cache/save@v4
with:
path: ${{ github.workspace }}/workdir/.ccache
key: ${{ matrix.name }}-${{ matrix.binaries }}-v${{ env.major_version }}-${{ github.run_id }}
- name: Upload Artifacts
if: env.create == '1'
uses: actions/upload-artifact@v4
with:
name: node-${{ env.version }}-linux-loong64-${{ matrix.binaries }}
path: ${{ github.workspace }}/dist/*
- name: Create release
if: env.create == '1'
run: |
latestFlag=""
if [ "${{ env.latest_version }}" != "true" ]; then
latestFlag="--latest=false"
fi
gh release create ${{ env.version }} -R ${{ github.repository }} --title ${{ env.version }} --notes "**Full Changelog**: [${{ env.version }}](https://github.com/nodejs/node/releases/tag/${{ env.version }})" ${latestFlag} || true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release:
if: needs.build-custom.outputs.create == '1'
needs: build-custom
runs-on: ubuntu-latest
env:
version: ${{ github.event.inputs.version }}
steps:
- uses: actions/checkout@v5
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Prepare scripts
run: |
sudo apt-get update
sudo apt-get install -y reprepro gnupg-agent
mkdir -p dist
echo > ~/.gnupg/gpg-agent.conf <<EOF
max-cache-ttl 60480000
default-cache-ttl 60480000
allow-preset-passphrase
EOF
gpg-connect-agent reloadagent /bye
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
pattern: node-*
path: dist
merge-multiple: true
- name: Sign Release
run: |
KEYGRIP=$(gpg -K --with-keygrip | grep Keygrip | head -1 | awk '{print $3}')
/usr/lib/gnupg2/gpg-preset-passphrase --preset "$KEYGRIP" <<< "${{ secrets.PASSPHRASE }}"
cd dist
rm -f SHASUMS256.txt SHASUMS256.txt.asc
sha256sum node-* > SHASUMS256.txt
gpg --output SHASUMS256.txt.asc --detach-sig SHASUMS256.txt
ls -lFh node-* SHASUMS256.txt*
for f in node-*; do
sha256sum "$f" > "$f".sha256
done
- name: Upload Release
run: |
gh release upload ${{ env.version }} -R ${{ github.repository }} dist/* --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}