forked from xkjyeah/vue-google-maps
-
Notifications
You must be signed in to change notification settings - Fork 52
148 lines (138 loc) · 4.17 KB
/
publish.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: publish
on:
push:
branches:
- master
pull_request:
branches: "*"
jobs:
install-and-cache:
name: Install dependencies
runs-on: linux-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 22.x
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Upload pnpm-lock.yaml as artifact
uses: actions/upload-artifact@v3
with:
name: pnpm-lock
path: pnpm-lock.yaml
outputs:
lock-file: ./pnpm-lock.yaml
build:
name: Build Project
runs-on: linux-latest
needs: [install-and-cache]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 22.x
cache: 'pnpm'
- name: Download pnpm-lock.yaml artifact
uses: actions/download-artifact@v3
with:
name: pnpm-lock
- name: Install dependencies
run: pnpm install --frozen-lockfile --ignore-scripts
- name: Build package
working-directory: ./packages/v3
run: pnpm run build
- name: Upload dist as artifact
uses: actions/upload-artifact@v3
with:
name: dist
path: ./packages/v3/dist
test:
name: Test project on linux and windows
runs-on: ${{ matrix.os }}
needs: [install-and-cache, build]
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [18.x, 20.x, 22.x]
test-plan: [test, "test:e2e"]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: pnpm install
- name: Create env file
run: |
touch ./packages/v3/cypress/runner/.env
echo VITE_GOOGLE_API_KEY=${{ secrets.VITE_GOOGLE_API_KEY }} >> ./packages/v3/cypress/runner/.env
- name: Run Test Plan
run: pnpm run ${{ matrix.test-plan }}
publish:
name: NPM publish
runs-on: linux-latest
needs: [install-and-cache, build, test]
if: ${{ github.ref == 'refs/heads/master'}}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 22.x
cache: 'pnpm'
- name: Download pnpm-lock.yaml artifact
uses: actions/download-artifact@v3
with:
name: pnpm-lock
- name: Download dist artifact
uses: actions/download-artifact@v3
with:
name: dist
- name: Install dependencies
run: pnpm install --frozen-lockfile --ignore-scripts
- name: Configure git credentials
uses: OleksiyRudenko/gha-git-credentials@v2-latest
with:
global: true
name: "${{ secrets.GH_USER }}"
email: "${{ secrets.GH_EMAIL }}"
actor: "${{ secrets.GH_FULL_NAME }}"
token: "${{ secrets.GH_TOKEN_REPO }}"
- name: Update origin push URI
run: |
git remote set-url origin "https://${{ secrets.GH_TOKEN_REPO }}@github.com/${{ secrets.GH_USER }}/${{ secrets.GH_REPOSITORY }}.git" > /dev/null 2>&1
git checkout master
- name: Preparing new release
working-directory: ./packages/v3
run: pnpm run release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_REPO }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
CI: true
- name: Publish new version to npm
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./packages/v3/package.json