-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (68 loc) · 2.1 KB
/
release.yml
File metadata and controls
76 lines (68 loc) · 2.1 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
name: Release
on:
workflow_dispatch:
inputs:
release-type:
description: "Release type"
required: true
type: choice
options: [latest, next]
preid:
description: "Prerelease identifier"
type: choice
options: ["", alpha, beta, rc, next]
jobs:
# STAGE 1: Versioning & Tagging
bump:
name: Version Bump
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
body: ${{ steps.release.outputs.body }}
steps:
- name: Generate Token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.BOT_APP_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
fetch-depth: 0
- name: Release Please
id: release
uses: googleapis/release-please-action@v4
with:
token: ${{ steps.app-token.outputs.token }}
skip-github-pull-request: true
prerelease: ${{ github.event.inputs.release-type == 'next' }}
prerelease-type: ${{ github.event.inputs.preid }}
# STAGE 2: Build & Publish
publish:
name: Build & Publish
needs: bump
if: ${{ needs.bump.outputs.release_created }}
runs-on: ubuntu-latest
environment: npm-publish
permissions:
id-token: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.bump.outputs.tag_name }}
- name: Build
uses: ./.github/actions/build
- name: Publish to NPM
run: pnpm publish --no-git-checks --provenance --access public
- name: GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.bump.outputs.tag_name }}
body: ${{ needs.bump.outputs.body }}
prerelease: ${{ github.event.inputs.release-type == 'next' }}