-
Notifications
You must be signed in to change notification settings - Fork 4
150 lines (143 loc) · 5.33 KB
/
build.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
149
150
name: "Build and Publish"
on:
push:
tags:
- v0.[0-9]+.[0-9]+
- v0.[0-9]+.[0-9]+-rc[0-9]+
- v0.[0-9]+.[0-9]+-beta[0-9]+
- v0.[0-9]+.[0-9]+-alpha[0-9]+
pull_request:
branches:
- master
workflow_dispatch:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
build:
name: Build and Publish
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
with:
path: 'sudu-editor'
-
name: Checkout TeaVM
uses: actions/checkout@v3
with:
repository: 'kirillp/teavm'
ref: 'master'
path: 'teavm'
-
name: Checkout Antlr4 TeaVM compatible repo
uses: actions/checkout@v3
with:
repository: 'pertsevpv/antlr4-teavm-compatible'
ref: 'master'
path: 'antlr4'
-
name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
-
name: Restore Maven and Gradle Cache
uses: actions/cache/restore@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.m2/repository
key: sudu-editor-cache
-
name: Install OBSUtil
if: github.event_name == 'push' && github.ref_type == 'tag'
run: |
curl -O https://obs-community-intl.obs.ap-southeast-1.myhuaweicloud.com/obsutil/current/obsutil_linux_amd64.tar.gz
tar -z -x -v --strip-components 1 --wildcards -f obsutil_linux_amd64.tar.gz obsutil*/obsutil
chmod +x ./obsutil
./obsutil config -e=${{ vars.OBS_ENDPOINT }} -i=${{ secrets.HW_ACCESS_KEY }} -k=${{ secrets.HW_SECRET_KEY }}
-
name: Maven TeaVM
run: |
cd $GITHUB_WORKSPACE/teavm
./gradlew publishToMavenLocal --no-daemon -x test
-
name: Maven Antlr4
run: |
cd $GITHUB_WORKSPACE/antlr4
mvn install -DskipTests
-
name: Maven Sudu Editor Release
if: github.event_name == 'push' && github.ref_type == 'tag'
run: |
cd $GITHUB_WORKSPACE/sudu-editor
mvn package -am -pl :codicon -pl :fonts -P downloadFont
mvn package -am -pl demo-edit-js,demo-edit-es-module -P release
-
name: Upload Sudu Editor to OBS
if: github.event_name == 'push' && github.ref_type == 'tag'
uses: nick-fields/retry@v3
id: retry
with:
max_attempts: 10
timeout_minutes: 5
retry_on: any
command: |
./obsutil rm -r -f obs://${{ vars.WEBAPP_OBS_NAME }}
./obsutil cp -r -f --flat $GITHUB_WORKSPACE/sudu-editor/demo-edit-js/target/demo-edit-js-1.0-SNAPSHOT/ obs://${{ vars.WEBAPP_OBS_NAME }}/
-
name: Upload release artifacts to OBS
if: github.event_name == 'push' && github.ref_type == 'tag'
run: |
NEW_VERSION=$(echo ${{ github.ref_name }} | tr -d 'v')
./obsutil cp $GITHUB_WORKSPACE/sudu-editor/demo-edit-es-module/module/src/editor.js obs://${{ vars.PUBLIC_OBS_NAME }}/sudu-editor/${NEW_VERSION}/dev/
./obsutil cp $GITHUB_WORKSPACE/sudu-editor/demo-edit-es-module/module/src/worker.js obs://${{ vars.PUBLIC_OBS_NAME }}/sudu-editor/${NEW_VERSION}/dev/
./obsutil cp $GITHUB_WORKSPACE/sudu-editor/demo-edit-es-module/module/src/loader.js obs://${{ vars.PUBLIC_OBS_NAME }}/sudu-editor/${NEW_VERSION}/dev/
-
name: Maven Sudu Editor
run: |
cd $GITHUB_WORKSPACE/sudu-editor
mvn package -am -pl demo-edit-es-module -P release
-
name: Upload artifacts to OBS
if: github.event_name == 'push' && github.ref_type == 'tag'
run: |
NEW_VERSION=$(echo ${{ github.ref_name }} | tr -d 'v')
./obsutil cp $GITHUB_WORKSPACE/sudu-editor/demo-edit-es-module/module/src/editor.js obs://${{ vars.PUBLIC_OBS_NAME }}/sudu-editor/${NEW_VERSION}/min/
./obsutil cp $GITHUB_WORKSPACE/sudu-editor/demo-edit-es-module/module/src/worker.js obs://${{ vars.PUBLIC_OBS_NAME }}/sudu-editor/${NEW_VERSION}/min/
./obsutil cp $GITHUB_WORKSPACE/sudu-editor/demo-edit-es-module/module/src/loader.js obs://${{ vars.PUBLIC_OBS_NAME }}/sudu-editor/${NEW_VERSION}/min/
-
name: Save Maven Cache
if: github.event_name == 'workflow_dispatch'
uses: actions/cache/save@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.m2/repository
key: sudu-editor-cache
-
name: Setup Node
uses: actions/setup-node@v3
if: github.event_name == 'push' && github.ref_type == 'tag'
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
scope: '@sudu-ide'
-
name: Publish Sudu Editor package to NPM Registry
if: github.event_name == 'push' && github.ref_type == 'tag'
run: |
NEW_VERSION=$(echo ${{ github.ref_name }} | tr -d 'v')
echo "::notice::version \"${NEW_VERSION}\""
cd $GITHUB_WORKSPACE/sudu-editor/demo-edit-es-module/module
npm version ${NEW_VERSION}
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}