-
-
Notifications
You must be signed in to change notification settings - Fork 1
97 lines (75 loc) · 2.69 KB
/
release.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
name: Release
on:
workflow_dispatch:
#At the end of every day
schedule:
- cron: '0 0 * * *'
jobs:
check-next-version:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18]
outputs:
next_version: ${{ steps.versionCheck.outputs.next_version }}
current_version: ${{ steps.versionCheck.outputs.current_version }}
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- id: versionCheck
run: |
echo "next_version=$(npm view happy-dom version)" >> $GITHUB_OUTPUT
echo "current_version=$(npm view happy-dom-without-node version || "0.0.0")" >> $GITHUB_OUTPUT
publish:
runs-on: ubuntu-latest
needs: [check-next-version]
if: ${{ needs.check-next-version.outputs.next_version != needs.check-next-version.outputs.current_version }}
strategy:
matrix:
node-version: [18]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Cache node modules
uses: actions/cache@v3
id: cache-node-modules
env:
cache-name: cache-node-modules
with:
path: ./node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-build-${{ env.cache-name }}-${{ hashFiles('./package-lock.json') }}
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci --ignore-scripts
- name: Install Happy DOM
run: npm install happy-dom@${{ needs.check-next-version.outputs.next_version }}
- name: Configures Git
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Creates release branch
run: |
git checkout -b release/${{ needs.check-next-version.outputs.next_version }} origin/main
git push origin release/${{ needs.check-next-version.outputs.next_version }}
- name: Prepare
run: npm run prepare
- name: Build distrubution
run: npm run build
- name: Run tests
run: npm run test
- name: Set .npmrc for publish
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_PUBLISH_TOKEN }}" > ./dist/.npmrc
- name: Publish packages
run: |
cd ./dist
npm publish