Skip to content

Commit c45285c

Browse files
authored
ci(NODE-5344): add alpha release automation (#3712)
1 parent 4e8386f commit c45285c

File tree

5 files changed

+69
-47
lines changed

5 files changed

+69
-47
lines changed

.github/actions/setup.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Setup
2+
description: 'Installs node, driver dependencies, and builds source'
3+
4+
steps:
5+
- uses: actions/setup-node@v3
6+
with:
7+
node-version: 'lts/*'
8+
cache: 'npm'
9+
registry-url: 'https://registry.npmjs.org'
10+
- run: npm install -g npm@latest
11+
- run: npm clean-install

.github/workflows/build_docs.yml

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ name: Build and commit docs
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66

77
permissions:
88
contents: write
99
pull-requests: write
1010

1111
jobs:
1212
build:
13-
1413
# prevent subsequent commits from triggering the job multiple times
1514
concurrency:
1615
group: ci-${{ github.ref }}
@@ -19,20 +18,20 @@ jobs:
1918
runs-on: ubuntu-latest
2019

2120
steps:
22-
- uses: actions/checkout@v3
23-
- name: Setup NodeJS
24-
uses: actions/setup-node@v3
25-
with:
26-
node-version: 16.x
27-
cache: 'npm'
28-
- name: Install Dependencies
29-
run: |
30-
npm ci
31-
sudo apt-get install hugo
32-
- name: Build Docs
33-
run: npm run build:docs -- --yes
34-
- name: Open Pull Request
35-
uses: peter-evans/create-pull-request@v4
36-
with:
37-
title: 'docs: generate docs from latest main'
38-
delete-branch: true
21+
- uses: actions/checkout@v3
22+
# TODO: replace with setup
23+
- uses: actions/setup-node@v3
24+
with:
25+
node-version: 'lts/*'
26+
cache: 'npm'
27+
registry-url: 'https://registry.npmjs.org'
28+
- run: npm install -g npm@latest
29+
- run: npm clean-install
30+
- run: sudo apt-get install hugo
31+
- name: Build Docs
32+
run: npm run build:docs -- --yes
33+
- name: Open Pull Request
34+
uses: peter-evans/create-pull-request@v4
35+
with:
36+
title: 'docs: generate docs from latest main'
37+
delete-branch: true

.github/workflows/dependencies.yml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,24 @@ name: Check Dependencies
22

33
on:
44
push:
5-
branches: [ "main" ]
5+
branches: [main]
66
pull_request:
7-
branches: [ "main" ]
7+
branches: [main]
88

99
permissions:
1010
contents: read
1111

1212
jobs:
1313
build:
1414
runs-on: ubuntu-latest
15-
strategy:
16-
matrix:
17-
node-version: [20.x]
1815
steps:
19-
- uses: actions/checkout@v3
20-
- name: Use Node.js ${{ matrix.node-version }}
21-
uses: actions/setup-node@v3
22-
with:
23-
node-version: ${{ matrix.node-version }}
24-
cache: 'npm'
25-
- run: npm clean-install
26-
- run: npm run check:dependencies
16+
- uses: actions/checkout@v3
17+
# TODO: replace with setup
18+
- uses: actions/setup-node@v3
19+
with:
20+
node-version: 'lts/*'
21+
cache: 'npm'
22+
registry-url: 'https://registry.npmjs.org'
23+
- run: npm install -g npm@latest
24+
- run: npm clean-install
25+
- run: npm run check:dependencies

.github/workflows/release-alpha.yml

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,36 @@ on:
44
workflow_dispatch:
55
inputs:
66
alphaVersion:
7-
description: 'The semver version string. MUST end in -alpha.#'
7+
description: 'Enter alpha version'
88
required: true
99
type: string
10-
wetRun:
11-
description: 'If true, will publish to npm'
12-
required: true
13-
type: boolean
1410

1511
name: release-alpha
1612

1713
jobs:
18-
release-nightly:
14+
release-alpha:
1915
runs-on: ubuntu-latest
16+
permissions:
17+
id-token: write
2018
steps:
21-
- run: |
22-
[[ "${{ inputs.alphaVersion }}" =~ '-alpha(\.(0|[1-9][0-9]+))?$' ]] || { echo "Invalid alphaVersion string" ; exit 1; }
23-
[[ "${{ inputs.wetRun }}" == "true" || "${{ inputs.wetRun }}" == "false" ]] || { echo "boolean wetRun must be provided" ; exit 1; }
24-
shell: bash
25-
- run: |
26-
echo "${{ inputs.alphaVersion }}"
27-
echo "${{ inputs.wetRun }}"
28-
shell: bash
19+
- shell: bash
20+
run: |
21+
ALPHA_SEMVER_REGEXP="-alpha(\.(0|[1-9][0-9]+))?$"
22+
23+
if ! [[ "${{ inputs.alphaVersion }}" =~ $ALPHA_SEMVER_REGEXP ]]; then
24+
echo "Invalid alphaVersion string"
25+
exit 1
26+
fi
27+
- uses: actions/checkout@v3
28+
# TODO: replace with setup
29+
- uses: actions/setup-node@v3
30+
with:
31+
node-version: 'lts/*'
32+
cache: 'npm'
33+
registry-url: 'https://registry.npmjs.org'
34+
- run: npm install -g npm@latest
35+
- run: npm clean-install
36+
- run: npm version "${{ inputs.alphaVersion }}" --git-tag-version=false
37+
- run: npm publish --provenance --tag=alpha
38+
env:
39+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/release-nightly.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ jobs:
2020
id-token: write
2121
steps:
2222
- uses: actions/checkout@v3
23+
# TODO: replace with setup
2324
- uses: actions/setup-node@v3
2425
with:
2526
node-version: 'lts/*'
27+
cache: 'npm'
2628
registry-url: 'https://registry.npmjs.org'
27-
- run: npm install -g npm
29+
- run: npm install -g npm@latest
2830
- run: npm clean-install
2931
- id: build_nightly
3032
run: npm run build:nightly

0 commit comments

Comments
 (0)