-
Notifications
You must be signed in to change notification settings - Fork 60
100 lines (80 loc) · 2.75 KB
/
Copy pathrelease.yml
File metadata and controls
100 lines (80 loc) · 2.75 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
name: release
on:
push:
tags:
- v*
jobs:
check_branch:
runs-on: ubuntu-latest
outputs:
should_build: ${{ steps.permitted.outputs.result }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Fetch remote branches
run: |
git fetch origin --depth=1
- name: Check if on permitted branch
id: permitted
run: |
result=
if git branch -a --contains $GITHUB_SHA | grep -q 'remotes/origin/master$'; then
result=true
elif git branch -a --contains $GITHUB_SHA | grep -q 'remotes/origin/.*-release$'; then
result=true
fi
echo "result=${result}" >> "$GITHUB_OUTPUT"
release:
runs-on: ubuntu-22.04
needs: check_branch
permissions:
contents: write
if: ${{ github.repository_owner == 'visgl' && needs.check_branch.outputs.should_build }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_ACCESS_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@v4
with:
node-version: '24'
- name: Enable Corepack
run: corepack enable yarn
- name: Install dependencies
run: yarn install --immutable
- name: Build packages
run: yarn build
- name: Run tests
run: |
yarn lint
yarn test
- name: Login to NPM
run: npm config set "//registry.npmjs.org/:_authToken=${NPM_ACCESS_TOKEN}"
- name: Verify NPM token
run: |
npm ping
npm whoami
node - <<'NODE'
const fs = require('fs');
const path = require('path');
const packageDirs = ['modules', 'dev'].flatMap((root) =>
fs.existsSync(root)
? fs
.readdirSync(root, {withFileTypes: true})
.filter((entry) => entry.isDirectory())
.map((entry) => path.join(root, entry.name))
: []
);
const packages = packageDirs
.map((directory) => path.join(directory, 'package.json'))
.filter((filename) => fs.existsSync(filename))
.map((filename) => JSON.parse(fs.readFileSync(filename, 'utf8')))
.filter((pkg) => pkg.name?.startsWith('@deck.gl-community/') && !pkg.private)
.map((pkg) => pkg.name)
.sort();
console.log(`NPM token is valid. Publishing ${packages.length} public packages:`);
for (const name of packages) {
console.log(`- ${name}`);
}
NODE
- name: Publish to NPM
run: npx ocular-publish from-git