forked from nodegit/nodegit
-
Notifications
You must be signed in to change notification settings - Fork 1
152 lines (132 loc) · 5.15 KB
/
release.yml
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
name: Release
on:
push:
tags:
- v*.*.*
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
version: [
{ node: 20.9.0, electron: 29.1.4, openssl: 1.1.1w }
]
steps:
- name: Checkout git repository
uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
with:
node-version: ${{ matrix.version.node }}
cache: 'npm'
- name: Setup (linux)
if: matrix.os == 'ubuntu-latest'
# git >= 2.18 required for actions/checkout git support
run: |
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo add-apt-repository -y ppa:git-core/ppa
sudo apt-get update
sudo apt-get install -y git build-essential clang python3 libssl-dev libkrb5-dev libc++-dev
echo "npm_config_openssl_dir=${{ github.workspace }}/openssl-${{ matrix.version.openssl }}/build" >> "$GITHUB_ENV"
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
- name: Cache Openssl (linux)
if: matrix.os == 'ubuntu-latest'
id: cache-openssl
uses: actions/cache@v4
with:
path: openssl-${{ matrix.version.openssl }}
key: ${{ runner.os }}-openssl-${{ matrix.version.openssl }}
- name: Build Openssl (linux)
if: matrix.os == 'ubuntu-latest' && steps.cache-openssl.outputs.cache-hit != 'true'
run: |
wget -qO- https://www.openssl.org/source/openssl-${{ matrix.version.openssl }}.tar.gz | tar -xz
cd openssl-${{ matrix.version.openssl }}
./config --prefix=${{ github.workspace }}/openssl-${{ matrix.version.openssl }}/build --openssldir=${{ github.workspace }}/openssl-${{ matrix.version.openssl }}/build
make
make install
- name: Setup (macos)
if: matrix.os == 'macos-latest'
run: |
echo "npm_config_openssl_dir=/usr/local/opt/[email protected]" >> "$GITHUB_ENV"
- name: Setup (windows)
if: matrix.os == 'windows-latest'
run: |
echo "npm_config_msvs_version=2022" >> $env:GITHUB_ENV
echo "npm_config_openssl_dir=C:\Program Files\OpenSSL" >> $env:GITHUB_ENV
- name: Install
env:
CC: clang
CXX: clang++ -static-libgcc -static-libstdc++
npm_config_clang: 1
GYP_DEFINES: use_obsolete_asm=true
NODEGIT_OPENSSL_STATIC_LINK: 1
run: npm ci --arch=x64 --runtime=electron --target=${{ matrix.version.electron }} --target_arch=x64 --disturl=https://electronjs.org/headers --build_from_source=true
- name: Deploy
env:
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm install -g @mapbox/node-pre-gyp
node lifecycleScripts/clean
npx node-pre-gyp package --runtime=electron --target=${{ matrix.version.electron }}
npx node-pre-gyp-github publish
- name: Setup (macos M1)
if: matrix.os == 'macos-latest'
run: |
brew install grep
brew uninstall --ignore-dependencies [email protected]
FILE=$(brew fetch --force --bottle-tag=arm64_big_sur [email protected] | ggrep -oP '(?<=Downloaded to\: ).*')
echo "$FILE"
brew install "$FILE"
- name: Install (macos M1)
if: matrix.os == 'macos-latest'
env:
CC: clang
CXX: clang++
CFLAGS: -target arm64-apple-macos11
npm_config_clang: 1
GYP_DEFINES: use_obsolete_asm=true
NODEGIT_OPENSSL_STATIC_LINK: 1
run: npm ci --arch=arm64 --runtime=electron --target=${{ matrix.version.electron }} --target_arch=arm64 --disturl=https://electronjs.org/headers --build_from_source=true
- name: Deploy (macos M1)
if: matrix.os == 'macos-latest'
env:
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm install -g @mapbox/node-pre-gyp
node lifecycleScripts/clean
npx node-pre-gyp package --runtime=electron --target=${{ matrix.version.electron }} --arch=arm64 --target_arch=arm64
npx node-pre-gyp-github publish
- name: Prepare artifact for upload
if: matrix.os == 'ubuntu-latest'
run: |
touch artifact.tar.gz
tar -zcf artifact.tar.gz --exclude=artifact.tar.gz .
- name: Upload artifact
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: build-ubuntu
path: artifact.tar.gz
if-no-files-found: error
retention-days: 5
publish:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: build-ubuntu
- name: Extract artifact
run: tar -xzf artifact.tar.gz
- name: Publish
env:
NPM_PUBLISH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
run: |
npm config set //registry.npmjs.org/:_authToken ${NPM_PUBLISH_TOKEN}
npm publish --access public