-
Notifications
You must be signed in to change notification settings - Fork 213
190 lines (167 loc) · 8.24 KB
/
publish_po_angular_ci.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
name: PO-UI Publish
# URL para os pacotes po-ui no npm
env:
SCHEMATICS_NPM_PATH: po-ui/ng-schematics
STORAGE_NPM_PATH: po-ui/ng-storage
SYNC_NPM_PATH: po-ui/ng-sync
COMPONENTS_NPM_PATH: po-ui/ng-components
TEMPLATES_NPM_PATH: po-ui/ng-templates
CODE_EDITOR_NPM_PATH: po-ui/ng-code-editor
AZURE_WEBAPP_NAME: wa-po-ui
AZURE_WEBAPP_PACKAGE_PATH: /home/runner/work/po-angular/po-angular/po-angular/dist/portal
WORKING_DIR: /home/runner/work/po-angular/po-angular/po-angular
on:
workflow_dispatch:
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Check out po-angular
uses: actions/checkout@v4
with:
path: po-angular
- name: Check out style
uses: actions/checkout@v4
with:
repository: po-ui/po-style
path: po-style
- name: Check out lint
uses: actions/checkout@v4
with:
repository: po-ui/po-tslint
path: po-tslint
- name: Install and Build
run: npm install && npm run build
working-directory: ${{env.WORKING_DIR}}
# Pega a última versão dos pacotes publicados no npm e armazena em variáveis
- run: echo "SCHEMATICS_LAST_PUBLISHED_VERSION=$(npm view @${{ env.SCHEMATICS_NPM_PATH }} dist-tags.next)" >> $GITHUB_ENV
- run: echo "STORAGE_LAST_PUBLISHED_VERSION=$(npm view @${{ env.STORAGE_NPM_PATH }} dist-tags.next)" >> $GITHUB_ENV
- run: echo "SYNC_LAST_PUBLISHED_VERSION=$(npm view @${{ env.SYNC_NPM_PATH }} dist-tags.next)" >> $GITHUB_ENV
- run: echo "COMPONENTS_LAST_PUBLISHED_VERSION=$(npm view @${{ env.COMPONENTS_NPM_PATH }} dist-tags.next)" >> $GITHUB_ENV
- run: echo "TEMPLATES_LAST_PUBLISHED_VERSION=$(npm view @${{ env.TEMPLATES_NPM_PATH }} dist-tags.next)" >> $GITHUB_ENV
- run: echo "CODE_EDITOR_LAST_PUBLISHED_VERSION=$(npm view @${{ env.CODE_EDITOR_NPM_PATH }} dist-tags.next)" >> $GITHUB_ENV
# Pega a versão no package.json
- name: Get package.json version.
id: package-version
uses: martinbeentjes/npm-get-version-action@main
with:
path: po-angular
# PUBLISH NG-SCHEMATICS
- name: ng-schematics - publish
# Se a versão remota for igual à versão que será publicada então ele pula o publish deste pacote e tenta publicar os demais pacotes
#if: (!contains(env.PACKAGE_VERSION, env.SCHEMATICS_LAST_PUBLISHED_VERSION))
uses: actions/setup-node@v3
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- run: npm publish ${{env.WORKING_DIR}}/dist/ng-schematics --ignore-scripts
env:
PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: ng-schematics - add "latest" tag
if: (!contains(env.PACKAGE_VERSION, env.SCHEMATICS_LAST_PUBLISHED_VERSION) && !contains(env.PACKAGE_VERSION, '-next') && !contains(env.PACKAGE_VERSION, '-rc'))
run: npm dist-tags add @${{ env.SCHEMATICS_NPM_PATH }}@${{ env.PACKAGE_VERSION }}
working-directory: ${{env.WORKING_DIR}}
env:
PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# PUBLISH NG-STORAGE
- name: ng-storage - publish
if: (!contains(env.PACKAGE_VERSION, env.STORAGE_LAST_PUBLISHED_VERSION))
uses: actions/setup-node@v3
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- run: npm publish ${{env.WORKING_DIR}}/dist/ng-storage --ignore-scripts
env:
PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: ng-storage - add "latest" tag
if: (!contains(env.PACKAGE_VERSION, env.STORAGE_LAST_PUBLISHED_VERSION) && !contains(env.PACKAGE_VERSION, '-next') && !contains(env.PACKAGE_VERSION, '-rc'))
run: npm dist-tags add @${{ env.STORAGE_NPM_PATH }}@${{ env.PACKAGE_VERSION }}
working-directory: ${{env.WORKING_DIR}}
env:
PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# PUBLISH NG-SYNC
- name: ng-sync - publish
if: (!contains(env.PACKAGE_VERSION, env.SYNC_LAST_PUBLISHED_VERSION))
uses: actions/setup-node@v3
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- run: npm publish ${{env.WORKING_DIR}}/dist/ng-sync --ignore-scripts
env:
PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: ng-sync - add "latest" tag
if: (!contains(env.PACKAGE_VERSION, env.SYNC_LAST_PUBLISHED_VERSION) && !contains(env.PACKAGE_VERSION, '-next') && !contains(env.PACKAGE_VERSION, '-rc'))
run: npm dist-tags add @${{ env.SYNC_NPM_PATH }}@${{ env.PACKAGE_VERSION }}
working-directory: ${{env.WORKING_DIR}}
env:
PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# PUBLISH NG-COMPONENTS
- name: ng-components - publish
if: (!contains(env.PACKAGE_VERSION, env.COMPONENTS_LAST_PUBLISHED_VERSION))
uses: actions/setup-node@v3
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- run: npm publish ${{env.WORKING_DIR}}/dist/ng-components --ignore-scripts
env:
PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: ng-components - add "latest" tag
if: (!contains(env.PACKAGE_VERSION, env.COMPONENTS_LAST_PUBLISHED_VERSION) && !contains(env.PACKAGE_VERSION, '-next') && !contains(env.PACKAGE_VERSION, '-rc'))
run: npm dist-tags add @${{ env.COMPONENTS_NPM_PATH }}@${{ env.PACKAGE_VERSION }}
working-directory: ${{env.WORKING_DIR}}
env:
PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# PUBLISH NG-TEMPLATES
- name: ng-templates - publish
if: (!contains(env.PACKAGE_VERSION, env.TEMPLATES_LAST_PUBLISHED_VERSION))
uses: actions/setup-node@v3
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- run: npm publish ${{env.WORKING_DIR}}/dist/ng-templates --ignore-scripts
env:
PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: ng-templates - add "latest" tag
if: (!contains(env.PACKAGE_VERSION, env.TEMPLATES_LAST_PUBLISHED_VERSION) && !contains(env.PACKAGE_VERSION, '-next') && !contains(env.PACKAGE_VERSION, '-rc'))
run: npm dist-tags add @${{ env.TEMPLATES_NPM_PATH }}@${{ env.PACKAGE_VERSION }}
working-directory: ${{env.WORKING_DIR}}
env:
PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# PUBLISH NG-CODE-EDITOR
- name: ng-code-editor - publish
if: (!contains(env.PACKAGE_VERSION, env.CODE_EDITOR_LAST_PUBLISHED_VERSION))
uses: actions/setup-node@v3
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- run: npm publish ${{env.WORKING_DIR}}/dist/ng-code-editor --ignore-scripts
env:
PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: ng-code-editor - add "latest" tag
if: (!contains(env.PACKAGE_VERSION, env.CODE_EDITOR_LAST_PUBLISHED_VERSION) && !contains(env.PACKAGE_VERSION, '-next') && !contains(env.PACKAGE_VERSION, '-rc'))
run: npm dist-tags add @${{ env.CODE_EDITOR_NPM_PATH }}@${{ env.PACKAGE_VERSION }}
working-directory: ${{env.WORKING_DIR}}
env:
PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# PUBLISH PORTAL
- name: portal build
run: npm run build:portal:docs && npm run build:portal:prod
working-directory: ${{env.WORKING_DIR}}
- name: 'Deploy to Azure Web App'
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
publish-profile: ${{ secrets.AZURE_TOKEN }}