-
Notifications
You must be signed in to change notification settings - Fork 879
146 lines (127 loc) · 3.87 KB
/
main.yml
File metadata and controls
146 lines (127 loc) · 3.87 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
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
name: CI
on:
workflow_dispatch: {}
push:
branches:
- master
- beta
- private-preview
- sdk-release/**
- feature/**
tags:
- v[0-9]+.[0-9]+.[0-9]+*
pull_request:
branches:
- master
- beta
- private-preview
- sdk-release/**
- feature/**
permissions: {}
jobs:
build:
name: 'Static Checks'
runs-on: 'ubuntu-24.04'
permissions:
contents: read
steps:
- uses: extractions/setup-just@v2
- uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: '22'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> "$GITHUB_OUTPUT"
- uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Verify Linting
run: just lint-check
- name: Verify Formatting
run: just format-check
test:
name: Test (${{ matrix.node }})
needs: [build]
strategy:
fail-fast: false
matrix:
os:
- 'ubuntu-24.04'
node:
# should include even numbers >= 16
# see: https://docs.stripe.com/sdks/versioning?lang=node#stripe-sdk-language-version-support-policy
- '22'
- '20'
- '18'
- '16'
runs-on: ${{ matrix.os }}
permissions:
contents: read
steps:
- uses: extractions/setup-just@v2
- uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
- name: Print Node.js version
run: node -v
# used for one of the integration tests
- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Print Deno version
run: deno -V
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> "$GITHUB_OUTPUT"
- uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
# searching very deep deps can time out, so only cache on the root yarn.lock
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- uses: stripe/openapi/actions/stripe-mock@master
- name: Test
run: just ci-test
publish:
name: Publish
if: >-
(github.event_name == 'workflow_dispatch' || github.event_name == 'push') &&
startsWith(github.ref, 'refs/tags/v') &&
endsWith(github.actor, '-stripe')
needs: [build, test]
runs-on: 'ubuntu-24.04'
permissions:
contents: read
id-token: write # Required for OIDC
steps:
# just is called in `yarn prepack`, which is called during the `publish` operation
- uses: extractions/setup-just@v2
- uses: actions/checkout@v2
- uses: actions/setup-node@v4
with:
node-version: '24'
registry-url: 'https://registry.npmjs.org'
- run: npm install -g npm@11
- name: Publish to NPM
run: |
set -euxo pipefail
VERSION=$(cat package.json | jq -r '.version')
# use the tag correlating to this release channel
NPM_TAG=$(cat package.json | jq -r '.version | if contains("beta") then "public-preview" else if contains("alpha") then "private-preview" else "latest" end end')
echo "Publishing $VERSION with $NPM_TAG tag."
npm publish --tag $NPM_TAG
- uses: stripe/openapi/actions/notify-release@master
if: always()
with:
bot_token: ${{ secrets.SLACK_BOT_TOKEN }}