forked from FredrikNoren/ungit
-
Notifications
You must be signed in to change notification settings - Fork 0
147 lines (129 loc) · 5.29 KB
/
ci.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
name: CI
on: [push, pull_request]
jobs:
test:
strategy:
fail-fast: false
matrix:
node-version: ['16', '18', '20']
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
# env:
# electron-packager (win32 ia32 on macos) https://github.com/electron/electron-packager/pull/449#issuecomment-240508298
# WINEDLLOVERRIDES: 'mscoree,mshtml='
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
# linux dependencies
- run: sudo apt update && sudo apt install -y wine64
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '16'
- run: wine --version
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '16'
- run: sudo add-apt-repository ppa:git-core/ppa -y && sudo apt-get update -q && sudo apt-get install -y git
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '*'
# macos dependencies
# required for electron-packager
# - run: brew update && brew cask install xquartz wine-stable
# if: matrix.os == 'macos-latest' && matrix.node-version == '16'
# - run: wine64 --version
# if: matrix.os == 'macos-latest' && matrix.node-version == '16'
- run: brew reinstall git
if: matrix.os == 'macos-latest' && matrix.node-version == '*'
# windows dependencies
# https://github.community/t5/GitHub-Actions/TEMP-is-broken-on-Windows/td-p/30432
- run: echo "TEMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV
if: matrix.os == 'windows-latest'
- run: choco upgrade git
if: matrix.os == 'windows-latest' && matrix.node-version == '*'
- run: git --version
- run: git config --global user.email "[email protected]"
- run: git config --global user.name "Test testy"
- run: git config --global protocol.file.allow always # tests use file based submodules see #1539
- run: npm ci
- run: npm run lint
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '16'
- run: npm run build
- run: npm test
# publish artifacts
- run: npm pack
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '16'
- run: npm run electronpackage -- --all
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '16'
- run: npm run electronzip
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '16'
- name: Upload npm pack
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '16'
uses: actions/upload-artifact@v3
with:
name: ungit
path: ungit-*.tgz
retention-days: 7
- name: Upload ungit-darwin-arm64
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '16'
uses: actions/upload-artifact@v3
with:
name: ungit-darwin-arm64
path: dist/ungit-darwin-arm64.zip
retention-days: 7
- name: Upload ungit-darwin-x64
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '16'
uses: actions/upload-artifact@v3
with:
name: ungit-darwin-x64
path: dist/ungit-darwin-x64.zip
retention-days: 7
- name: Upload ungit-linux-arm64
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '16'
uses: actions/upload-artifact@v3
with:
name: ungit-linux-arm64
path: dist/ungit-linux-arm64.zip
retention-days: 7
- name: Upload ungit-linux-armv7l
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '16'
uses: actions/upload-artifact@v3
with:
name: ungit-linux-armv7l
path: dist/ungit-linux-armv7l.zip
retention-days: 7
- name: Upload ungit-linux-x64
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '16'
uses: actions/upload-artifact@v3
with:
name: ungit-linux-x64
path: dist/ungit-linux-x64.zip
retention-days: 7
- name: Upload ungit-win32-arm64
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '16'
uses: actions/upload-artifact@v3
with:
name: ungit-win32-arm64
path: dist/ungit-win32-arm64.zip
retention-days: 7
- name: Upload ungit-win32-ia32
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '16'
uses: actions/upload-artifact@v3
with:
name: ungit-win32-ia32
path: dist/ungit-win32-ia32.zip
retention-days: 7
- name: Upload ungit-win32-x64
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '16'
uses: actions/upload-artifact@v3
with:
name: ungit-win32-x64
path: dist/ungit-win32-x64.zip
retention-days: 7
- name: npm publish
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '16' && github.repository == 'FredrikNoren/ungit' && github.ref == 'refs/heads/master'
uses: actions/github-script@v6
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
with:
script: |
const script = require('./scripts/npmpublish.js')
await script({github, context, core, exec})