-
-
Notifications
You must be signed in to change notification settings - Fork 43
164 lines (144 loc) · 7.08 KB
/
Copy pathrelease.yml
File metadata and controls
164 lines (144 loc) · 7.08 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: 🏷️ Release to NPM
on:
workflow_dispatch:
inputs:
dryrun:
type: boolean
description: Dry-Run
tag:
type: choice
default: latest
description: NPM tag (defaults to 'latest')
options:
- latest
- alpha
- beta
- next
graduate:
type: boolean
description: Force Conventional Graduate
version:
description: 'Fixed Version'
required: false
type: string
skip_version_retry_publish:
type: boolean
description: 'Skip running `lerna version` and run publish-only retry (useful to retry failed publish)'
permissions:
contents: write # to be able to publish a GitHub release
id-token: write # to enable use of OIDC for npm provenance
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
jobs:
deploy-npm-latest:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Retrieve current Date Time in EST
shell: bash
run: echo "START_TIME=$(TZ=":America/New_York" date -R|sed 's/.....$//')" >> $GITHUB_ENV
- name: Current datetime - ${{ env.START_TIME }}
run: echo ${{ env.START_TIME }}
- name: Clone repository
uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- if: ${{ github.event.pull_request.merged != true && contains('["ghiscoding"]', github.actor) != true }}
name: Exit early when current actor is not allowed to push new release
run: |
echo "Error: Your GitHub username (${{ github.actor }}) is not on the allowed list of Admins that can run this workflow"
exit 1
- name: Install pnpm
uses: pnpm/action-setup@v5
with:
run_install: false
- name: Set NodeJS
uses: actions/setup-node@v6
with:
registry-url: 'https://registry.npmjs.org/'
node-version: 24
- run: node --version
- run: npm --version
- name: Run pnpm install dependencies
run: pnpm install
- name: Build Everything
run: pnpm build
- name: Lerna Version (build query)
if: ${{ inputs.skip_version_retry_publish != true }}
shell: bash
run: |
if [ "${{ inputs.dryrun }}" = "true" ] && [ "${{ inputs.graduate }}" = "true" ]; then
echo "LERNA_VERSION_TYPE=Dry-Run 🧪 - Prod Version w/Graduate" >> $GITHUB_ENV
echo "LERNA_VERSION_QUERY=lerna version --yes --conventional-graduate --dry-run" >> $GITHUB_ENV
elif [ "${{ inputs.dryrun }}" = "true" ] && [ -n "${{ inputs.version }}" ]; then
echo "LERNA_VERSION_TYPE=Dry-Run 🧪 - Fixed Version" >> $GITHUB_ENV
echo "LERNA_VERSION_QUERY=lerna version ${{ inputs.version }} --yes --dry-run" >> $GITHUB_ENV
elif [ "${{ inputs.dryrun }}" = "true" ] && { [ "${{ inputs.tag }}" = "alpha" ] || [ "${{ inputs.tag }}" = "beta" ] || [ "${{ inputs.tag }}" = "next" ]; }; then
echo "LERNA_VERSION_TYPE=Dry-Run 🧪 - Pre-Release" >> $GITHUB_ENV
echo "LERNA_VERSION_QUERY=lerna version --yes --conventional-prerelease --preid ${{ inputs.tag }} --dry-run" >> $GITHUB_ENV
elif [ "${{ inputs.dryrun }}" = "true" ]; then
echo "LERNA_VERSION_TYPE=Dry-Run 🧪" >> $GITHUB_ENV
echo "LERNA_VERSION_QUERY=lerna version --yes --dry-run" >> $GITHUB_ENV
elif [ "${{inputs.dryrun }}" != "true" ] && [ "${{ inputs.graduate }}" = "true" ]; then
echo "LERNA_VERSION_TYPE=Prod Version 🚀 - w/Graduate" >> $GITHUB_ENV
echo "LERNA_VERSION_QUERY=lerna version --yes --conventional-graduate" >> $GITHUB_ENV
elif [ -n "${{ inputs.version }}" ]; then
echo "LERNA_VERSION_TYPE=Prod Version 🚀 - Fixed Version" >> $GITHUB_ENV
echo "LERNA_VERSION_QUERY=lerna version ${{ inputs.version }} --yes" >> $GITHUB_ENV
elif [ "${{ inputs.tag }}" = "alpha" ] || [ "${{ inputs.tag }}" = "beta" ] || [ "${{ inputs.tag }}" = "next" ]; then
echo "LERNA_VERSION_TYPE=Prod Version 🚀 - Pre-Release" >> $GITHUB_ENV
echo "LERNA_VERSION_QUERY=lerna version --yes --conventional-prerelease --preid ${{ inputs.tag }}" >> $GITHUB_ENV
else
echo "LERNA_VERSION_TYPE=Prod Version 🚀" >> $GITHUB_ENV
echo "LERNA_VERSION_QUERY=lerna version --yes" >> $GITHUB_ENV
fi
- name: Final version type ➜ ${{ env.LERNA_VERSION_TYPE }}
shell: bash
run: echo "${{ env.LERNA_VERSION_QUERY }}"
- name: Lerna Version 🏷️
if: ${{ inputs.skip_version_retry_publish != true }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
pnpm exec ${{ env.LERNA_VERSION_QUERY }}
- name: Skip Lerna Version Notice
if: ${{ inputs.skip_version_retry_publish == true }}
run: |
echo "skip_version_retry_publish=true — lerna version is skipped; proceeding to publish-only run."
- name: Lerna Publish (build query)
shell: bash
run: |
if [ "${{ inputs.dryrun }}" = "true" ] && { [ "${{ inputs.tag }}" = "alpha" ] || [ "${{ inputs.tag }}" = "beta" ] || [ "${{ inputs.tag }}" = "next" ]; }; then
echo "LERNA_PUBLISH_TYPE=Dry-Run 🧪 - Pre-Release" >> $GITHUB_ENV
echo "LERNA_PUBLISH_QUERY=lerna publish from-package --force-publish --yes --pre-dist-tag ${{ inputs.tag }} --dry-run" >> $GITHUB_ENV
elif [ "${{ inputs.dryrun }}" = "true" ]; then
echo "LERNA_PUBLISH_TYPE=Dry-Run 🧪" >> $GITHUB_ENV
echo "LERNA_PUBLISH_QUERY=lerna publish from-package --force-publish --yes --dist-tag latest --dry-run" >> $GITHUB_ENV
elif [ "${{ inputs.tag }}" = "alpha" ] || [ "${{ inputs.tag }}" = "beta" ] || [ "${{ inputs.tag }}" = "next" ]; then
echo "LERNA_PUBLISH_TYPE=📦 Publish - Pre-Release" >> $GITHUB_ENV
echo "LERNA_PUBLISH_QUERY=lerna publish from-package --force-publish --yes --pre-dist-tag ${{ inputs.tag }}" >> $GITHUB_ENV
else
echo "LERNA_PUBLISH_TYPE=📦 Publish Latest" >> $GITHUB_ENV
echo "LERNA_PUBLISH_QUERY=lerna publish from-package --force-publish --yes --dist-tag latest" >> $GITHUB_ENV
fi
- name: Final publish type ➜ ${{ env.LERNA_PUBLISH_TYPE }}
shell: bash
run: echo "${{ env.LERNA_PUBLISH_QUERY }}"
- name: Lerna Publish 📦
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
id: lerna-publish
run: pnpm exec ${{ env.LERNA_PUBLISH_QUERY }}
- name: Website Dev Build
run: pnpm build:dev
- name: Deploy to gh-pages
if: github.ref == 'refs/heads/master'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./website