-
Notifications
You must be signed in to change notification settings - Fork 2
71 lines (58 loc) · 2.35 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
name: Publish Workflow
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Check if version has been updated
id: version_check
uses: EndBug/version-check@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
if: steps.version_check.outputs.changed == 'true'
uses: actions/setup-node@v2
with:
node-version: '18.16.1'
- name: Install pnpm
if: steps.version_check.outputs.changed == 'true'
run: npm install -g pnpm
- name: Install Dependencies
if: steps.version_check.outputs.changed == 'true'
run: pnpm install
- name: Build and Move Files
if: steps.version_check.outputs.changed == 'true'
run: |
VERSION=v${{steps.version_check.outputs.version}} pnpm build
mkdir -p "$GITHUB_WORKSPACE/v${{ steps.version_check.outputs.version }}"
mv schema/* "$GITHUB_WORKSPACE/v${{ steps.version_check.outputs.version }}"
mkdir -p "$GITHUB_WORKSPACE/v${{ steps.version_check.outputs.version }}/types"
mv types/* "$GITHUB_WORKSPACE/v${{ steps.version_check.outputs.version }}/types"
mkdir -p "$GITHUB_WORKSPACE/v${{ steps.version_check.outputs.version }}/examples"
mv examples/*.json "$GITHUB_WORKSPACE/v${{ steps.version_check.outputs.version }}/examples"
- name: Checkout Dist Branch
if: steps.version_check.outputs.changed == 'true'
run: |
git fetch origin dist
git checkout -b dist origin/dist
- name: Commit and Push Changes
if: steps.version_check.outputs.changed == 'true'
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git add .
git commit -m "Add build files for v${{ steps.version_check.outputs.version }}"
git push origin dist
- name: Create Release and Tag
if: steps.version_check.outputs.changed == 'true'
uses: actions/create-release@v1
with:
tag_name: v${{ steps.version_check.outputs.version }}
release_name: v${{ steps.version_check.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}