Skip to content

Commit 2303387

Browse files
update release pipeline
1 parent 32700a9 commit 2303387

File tree

1 file changed

+57
-11
lines changed

1 file changed

+57
-11
lines changed

.github/workflows/release.yml

+57-11
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,70 @@
1-
name: Release
1+
name: Manual NPM Publish
22

33
on:
4-
push:
5-
tags:
6-
- 'v*'
4+
workflow_dispatch:
5+
inputs:
6+
releaseType:
7+
description: "Release type - major, minor or patch"
8+
required: true
9+
type: choice
10+
default: "patch"
11+
options:
12+
- patch
13+
- minor
14+
- major
15+
distTag:
16+
description: 'NPM tag (e.g. use "next" to release a test version)'
17+
required: true
18+
default: 'latest'
19+
preRelease:
20+
description: If latest release was a pre-release (e.g. X.X.X-alpha.0) and you want to push another one, pick "yes"
21+
required: true
22+
type: choice
23+
default: "no"
24+
options:
25+
- "yes"
26+
- "no"
27+
28+
env:
29+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
30+
NPM_CONFIG_PROVENANCE: true
731

832
jobs:
933
release:
1034
runs-on: ubuntu-latest
1135
permissions:
12-
contents: write
36+
contents: write
37+
id-token: write
1338
steps:
14-
- uses: actions/checkout@v3
39+
- uses: actions/checkout@v2
1540
with:
41+
ref: 'main'
1642
fetch-depth: 0
17-
1843
- uses: actions/setup-node@v3
1944
with:
20-
node-version: lts/*
21-
22-
- run: npx changelogithub
45+
node-version: 18.x
46+
- name: Install Dependencies
47+
run: npm ci
48+
- name: Build
49+
run: npm run build
50+
- name: NPM Setup
51+
run: |
52+
npm set registry "https://registry.npmjs.org/"
53+
npm set //registry.npmjs.org/:_authToken $NPM_TOKEN
54+
npm whoami
55+
- name: Git Setup
56+
run: |
57+
git config --global user.email "git@bromann.dev"
58+
git config --global user.name "Christian Bromann"
59+
- name: Release
60+
run: npx release-it ${{github.event.inputs.releaseType}} --github.release --ci --npm.skipChecks --no-git.requireCleanWorkingDir --npm.tag=${{github.event.inputs.distTag}}
61+
env:
62+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
if: ${{ github.event.inputs.preRelease == 'no' }}
65+
- name: Pre-Release
66+
run: npx release-it ${{github.event.inputs.releaseType}} --github.release --ci --npm.skipChecks --no-git.requireCleanWorkingDir --preRelease=alpha --github.preRelease --npm.tag=next
2367
env:
24-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
68+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
if: ${{ github.event.inputs.preRelease == 'yes' }}

0 commit comments

Comments
 (0)