Skip to content

Commit 1da8d10

Browse files
authored
Merge pull request #2114 from kubernetes-client/rev2
Add the ability to push a non pre-release to NPM
2 parents 9741bc9 + a5507ac commit 1da8d10

File tree

1 file changed

+56
-46
lines changed

1 file changed

+56
-46
lines changed

.github/workflows/release.yml

+56-46
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,61 @@
11
name: Release
22

33
on:
4-
workflow_dispatch:
5-
inputs:
6-
releaseVersion:
7-
type: string
8-
required: true
9-
description: The version of this release. Must be a semantic version of the form X.Y.Z.
10-
dry_run:
11-
type: boolean
12-
required: true
13-
default: false
14-
description: Dry run, will not push branches or upload the artifacts.
15-
skip_tag:
16-
type: boolean
17-
required: true
18-
default: false
19-
description: If true, don't tag this release, just push it.
4+
workflow_dispatch:
5+
inputs:
6+
releaseVersion:
7+
type: string
8+
required: true
9+
description: The version of this release. Must be a semantic version of the form X.Y.Z.
10+
dry_run:
11+
type: boolean
12+
required: true
13+
default: false
14+
description: Dry run, will not push branches or upload the artifacts.
15+
skip_tag:
16+
type: boolean
17+
required: true
18+
default: false
19+
description: If true, don't tag this release, just push it.
20+
pre_release:
21+
type: boolean
22+
required: true
23+
default: false
24+
description: If true, mark this as a pre-release
2025

2126
jobs:
22-
release:
23-
runs-on: ubuntu-latest
24-
environment: production
25-
steps:
26-
- name: Checkout Javascript
27-
uses: actions/checkout@v4
28-
- name: Setup Node
29-
uses: actions/setup-node@v4
30-
with:
31-
node-version: '20'
32-
registry-url: 'https://registry.npmjs.org'
33-
- name: Install dependencies
34-
run: npm install
35-
- name: Package
36-
run: ./build-package.sh
37-
- name: Upload pre-release
38-
if: ${{ github.event.inputs.dry_run != 'true' }}
39-
run: npm publish --tag next
40-
env:
41-
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
42-
- name: Tag release
43-
if: ${{ github.event.inputs.skip_tag != 'true' }}
44-
run: |
45-
git config --global user.name 'Github Bot'
46-
git config --global user.email '<>'
47-
git tag ${{ github.events.inputs.version }}
48-
- name: Push tag
49-
if: ${{ github.event.inputs.dry_run != 'true' }}
50-
run: |
51-
git push ${{ github.events.inputs.version }}
27+
release:
28+
runs-on: ubuntu-latest
29+
environment: production
30+
steps:
31+
- name: Checkout Javascript
32+
uses: actions/checkout@v4
33+
- name: Setup Node
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: '20'
37+
registry-url: 'https://registry.npmjs.org'
38+
- name: Install dependencies
39+
run: npm install
40+
- name: Package
41+
run: ./build-package.sh
42+
- name: Upload release
43+
if: ${{ github.event.inputs.dry_run != 'true' && github.event.inputs.pre_release != 'true' }}
44+
run: npm publish
45+
env:
46+
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
47+
- name: Upload pre-release
48+
if: ${{ github.event.inputs.dry_run != 'true' && github.event.inputs.pre_release == 'true' }}
49+
run: npm publish --tag next
50+
env:
51+
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
52+
- name: Tag release
53+
if: ${{ github.event.inputs.skip_tag != 'true' }}
54+
run: |
55+
git config --global user.name 'Github Bot'
56+
git config --global user.email '<>'
57+
git tag ${{ github.events.inputs.version }}
58+
- name: Push tag
59+
if: ${{ github.event.inputs.dry_run != 'true' }}
60+
run: |
61+
git push ${{ github.events.inputs.version }}

0 commit comments

Comments
 (0)