-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
133 lines (117 loc) 路 3.47 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
133
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:
name: 馃敤 Build
if: github.repository == 'saadeghi/daisyui'
timeout-minutes: 10
runs-on: ubuntu-latest
env:
runtime: ${{ github.event.inputs.runtime || 'bun'}}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
if: env.runtime == 'npm'
uses: actions/setup-node@v3
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
run: |
git config --local user.email "pouya.saadeghi@gmail.com"
git config --local user.name "Pouya Saadeghi"
${{ env.runtime }} run release${{ github.event.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
id: commit
run: |
echo "VITE_DAISYUI_VERSION=${{ steps.package-version.outputs.version }}" > src/docs/.env
git config --local user.email "pouya.saadeghi@gmail.com"
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 }}
publish-npm:
name: 馃殌 Publish to NPM
if: github.repository == 'saadeghi/daisyui'
timeout-minutes: 5
runs-on: ubuntu-latest
needs: build
env:
runtime: ${{ github.event.inputs.runtime || 'bun'}}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
if: env.runtime != 'npm'
uses: actions/setup-node@v3
with:
node-version: "latest"
registry-url: https://registry.npmjs.org
- name: Publish package to NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
deploy-docs:
name: 馃摌 Docs
needs: publish-npm
uses: ./.github/workflows/deploy-docs.yml
secrets: inherit
run-tests:
name: 馃И Tests
needs: publish-npm
uses: ./.github/workflows/run-tests.yml
secrets: inherit
with:
filter: " "
write-release-notes:
name: 馃摑 Release notes
if: github.repository == 'saadeghi/daisyui'
needs: run-tests
uses: ./.github/workflows/write-release-notes.yml
secrets: inherit