-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
132 lines (117 loc) · 3.6 KB
/
release-new-version.yml
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
name: "🎉 Release new version"
on:
workflow_dispatch:
inputs:
runtime:
type: choice
description: JS runtime
default: "bun"
options:
- "bun"
- "npm"
release-type:
type: choice
description: Release type
options:
- " -- --patch"
- " -- --minor"
push:
branches:
- master
paths:
- "src/**"
- "!src/docs/**"
- "!src/tests/**"
- "!src/experiments/**"
jobs:
build-publish:
name: 🔨 Build + 🚀 Publish
timeout-minutes: 10
runs-on: ubuntu-latest
env:
runtime: ${{ inputs.runtime || 'bun'}}
outputs:
daisyuiversion: ${{ steps.package-version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
clean: false
- name: Setup Node
if: env.runtime == 'npm'
uses: actions/setup-node@v4
with:
node-version: "latest"
registry-url: https://registry.npmjs.org
- name: Setup Bun
if: env.runtime == 'bun'
uses: oven-sh/setup-bun@v1
- name: Install package dependencies
run: ${{ env.runtime }} install
- name: build package
run: ${{ env.runtime }} run build
- name: Run release command
if: github.repository == 'saadeghi/daisyui'
run: |
git config --local user.email "[email protected]"
git config --local user.name "Pouya Saadeghi"
${{ env.runtime }} run release${{ inputs.release-type }}
- name: Read package version from package.json
id: package-version
run: |
version=$(grep -o '"version": *"[^"]*"' package.json | cut -d'"' -f4)
echo version=$version >> $GITHUB_OUTPUT
- name: Update package version in src/docs/.env and commit
if: github.repository == 'saadeghi/daisyui'
id: commit
run: |
echo "VITE_DAISYUI_VERSION=${{ steps.package-version.outputs.version }}" > src/docs/.env
git config --local user.email "[email protected]"
git config --local user.name "Pouya Saadeghi"
git add --all
if [ -z "$(git status --porcelain)" ]; then
echo push=false >> $GITHUB_OUTPUT
else
git commit -m "Update src/docs/.env" -a
echo push=true >> $GITHUB_OUTPUT
fi
shell: bash
- name: Push changes
if: steps.commit.outputs.push == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node
if: env.runtime != 'npm'
uses: actions/setup-node@v4
with:
node-version: "latest"
registry-url: https://registry.npmjs.org
- name: Publish package to NPM
if: github.repository == 'saadeghi/daisyui'
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
deploy-docs:
name: 📘 Docs
needs: build-publish
uses: ./.github/workflows/deploy-docs.yml
secrets: inherit
with:
daisyuiversion: ${{ needs.build-publish.outputs.daisyuiversion }}
run-tests:
name: 🧪 Tests
needs: build-publish
uses: ./.github/workflows/run-tests.yml
secrets: inherit
with:
filter: " "
write-release-notes:
name: 📝 Release notes
if: github.repository == 'saadeghi/daisyui'
needs: build-publish
uses: ./.github/workflows/write-release-notes.yml
secrets: inherit
with:
daisyuiversion: ${{ needs.build-publish.outputs.daisyuiversion }}