forked from Leaflet/Leaflet
-
Notifications
You must be signed in to change notification settings - Fork 0
186 lines (161 loc) · 4.96 KB
/
main.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
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
185
186
name: CI
on: [push, pull_request]
permissions:
contents: read
env:
NODE_VERSION: 18
jobs:
setup:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
check-latest: true
cache: npm
- name: Install dependencies
run: npm ci
- name: Build project
run: npm run build
env:
NODE_ENV: ${{ startsWith(github.ref, 'refs/tags/v') && 'release' || '' }}
- name: Cache setup
uses: actions/cache@v4
with:
path: ./*
key: ${{ runner.os }}-${{ github.ref }}-${{ github.sha }}-setup
build-docs:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
working-directory: ./docs
- name: Run jekyll build
working-directory: ./docs
run: bundle exec jekyll build --strict_front_matter
lint:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Restore setup
uses: actions/cache@v4
with:
path: ./*
key: ${{ runner.os }}-${{ github.ref }}-${{ github.sha }}-setup
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Run lint task
run: npm run lint
bundlemon:
needs: setup
if: github.repository_owner == 'Leaflet'
runs-on: ubuntu-latest
steps:
- name: Restore setup
uses: actions/cache@v4
with:
path: ./*
key: ${{ runner.os }}-${{ github.ref }}-${{ github.sha }}-setup
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Build project
run: npm run build
env:
NODE_ENV: release
- name: Run bundlemon task
run: npm run bundlemon
env:
CI_COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
test:
needs: setup
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
strategy:
fail-fast: false
matrix:
include:
- browser: Chrome
- browser: Firefox
- browser: FirefoxNoTouch
- browser: FirefoxRetina
- browser: Chrome
os: windows-latest
- browser: Chrome
os: macos-latest
- browser: SafariNative
os: macos-latest
steps:
- name: Restore setup
uses: actions/cache@v4
with:
path: ./*
key: ${{ runner.os }}-${{ github.ref }}-${{ github.sha }}-setup
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Set up Google Chrome
uses: browser-actions/setup-chrome@v1
if: contains(matrix.browser, 'Chrome')
- name: Set up Firefox
uses: browser-actions/setup-firefox@v1
if: contains(matrix.browser, 'Firefox')
- name: Run tests on ${{ matrix.browser }}
run: npm test -- --browsers ${{ matrix.browser }} --single-run
publish-artifacts:
needs: setup
if: github.repository_owner == 'Leaflet' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
runs-on: ubuntu-latest
steps:
- name: Restore setup
uses: actions/cache@v4
with:
path: ./*
key: ${{ runner.os }}-${{ github.ref }}-${{ github.sha }}-setup
- name: Compress artifacts
working-directory: dist
run: zip -r leaflet.zip .
- name: Publish artifacts
uses: jakejarvis/[email protected]
with:
args: --acl public-read --delete --exact-timestamps
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SOURCE_DIR: dist
DEST_DIR: content/leaflet/${{ github.ref_name }}
publish-npm:
needs: setup
if: github.repository_owner == 'Leaflet' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Restore setup
uses: actions/cache@v4
with:
path: ./*
key: ${{ runner.os }}-${{ github.ref }}-${{ github.sha }}-setup
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: https://registry.npmjs.org
- name: Publish to NPM
run: |
TAG=$(echo $GITHUB_REF_NAME | grep -oP '^v\d+\.\d+\.\d+-?\K(\w+)?')
npm publish --tag ${TAG:-latest}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}