-
Notifications
You must be signed in to change notification settings - Fork 2
204 lines (184 loc) · 5.88 KB
/
npm-publish.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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# Copyright (c) 2016-2024 Knuth Project developers.
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
name: Build and Test
on: [push, pull_request]
# on:
# release:
# types: [created]
jobs:
# execute-linter:
# name: Execute ESLint
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-node@v3
# with:
# node-version: 16
# - name: Install modules
# run: npm install
# # - name: Run ESLint
# # run: npm run lint:github-action
generate-matrix:
# needs: execute-linter
name: Generate Job Matrix
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Generate Job Matrix
id: set-matrix
env:
MATRIX: '{"config": [
{"name": "macOS 14 (ARM) - NodeJS 20","nodejs_version": "20","os": "macos-14","os_kind": "macos", "os_version": "14.0","test": "0"}
]}'
run: |
echo "${MATRIX}"
echo "matrix=${MATRIX}" >> $GITHUB_OUTPUT
builds:
needs: generate-matrix
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix: ${{fromJson(needs.generate-matrix.outputs.matrix)}}
name: ${{ matrix.config.name }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.config.nodejs_version }}
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Settting EnvVars (macOS)
if: ${{ matrix.config.os_kind == 'macos' }}
shell: bash
run: |
echo "MACOSX_DEPLOYMENT_TARGET=${{ matrix.config.os_version }}" >> $GITHUB_ENV
# - name: Settting EnvVars (Unix)
# if: ${{ matrix.config.os_kind != 'windows' }}
# shell: bash
# run: |
# echo "NODEJS_VERSION=${{ matrix.config.nodejs_version }}" >> $GITHUB_ENV
# echo "KTH_GHA_MARCH_ID=${{ matrix.config.march_id }}" >> $GITHUB_ENV
# echo "KTH_GHA_RUN_TESTS=${{ matrix.config.test }}" >> $GITHUB_ENV
# - name: Settting EnvVars (Windows)
# if: ${{ matrix.config.os_kind == 'windows' }}
# shell: powershell
# run: |
# echo "NODEJS_VERSION=${{ matrix.config.nodejs_version }}" >> $Env:GITHUB_ENV
# echo "KTH_GHA_MARCH_ID=${{ matrix.config.march_id }}" >> $Env:GITHUB_ENV
# echo "KTH_GHA_RUN_TESTS=${{ matrix.config.test }}" >> $Env:GITHUB_ENV
- run: python --version
- run: python3 --version
# - run: npm install --loglevel verbose
- run: npm install
# - run: npm run lint:github-action
- run: git status
- run: git diff
- run: npm ci
# - run: npm test --runInBand
- run: npm test -- --verbose=true
if: ${{ matrix.config.test == '1' }}
publish-npm:
needs: builds
runs-on: ubuntu-latest
name: Public NPM
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
# publish:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# # Setup .npmrc file to publish to npm
# - uses: actions/setup-node@v3
# with:
# node-version: 16
# registry-url: 'https://registry.npmjs.org'
# - run: npm install
# # Publish to npm
# - run: npm publish --access public
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
# # Setup .npmrc file to publish to GitHub Packages
# - uses: actions/setup-node@v3
# with:
# registry-url: 'https://npm.pkg.github.com'
# # Defaults to the user or organization that owns the workflow file
# scope: '@octocat'
# # Publish to GitHub Packages
# - run: npm publish
# env:
# NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# publish-npm:
# needs: builds
# runs-on: ubuntu-latest
# name: Public NPM
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-node@v3
# with:
# node-version: 16
# - run: npm install
# - run: npm test
# # - run: npm ci
# - uses: JS-DevTools/npm-publish@v1
# with:
# token: ${{ secrets.NPM_AUTH_TOKEN }}
# registry: https://registry.npmjs.org/
# publish-gpr:
# needs: builds
# runs-on: ubuntu-latest
# name: Public GPR
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-node@v3
# with:
# node-version: 16
# - run: npm install
# # - run: npm test
# # - run: npm ci
# - uses: JS-DevTools/npm-publish@v1
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# registry: https://npm.pkg.github.com/
# publish-npm:
# needs: builds
# runs-on: ubuntu-latest
# name: Public NPM
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-node@v3
# with:
# node-version: 16
# registry-url: https://registry.npmjs.org/
# - run: npm ci
# - run: npm publish
# env:
# NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
# publish-gpr:
# # needs: publish-npm
# needs: builds
# runs-on: ubuntu-latest
# name: Public GPR
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-node@v3
# with:
# node-version: 16
# registry-url: https://npm.pkg.github.com/
# # - run: npm login
# # - run: npm ci
# - run: npm ci
# - run: npm publish
# env:
# NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}