-
Notifications
You must be signed in to change notification settings - Fork 212
175 lines (152 loc) · 6.59 KB
/
publish_po_angular_ci-beta.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
name: PO-UI Publish Beta
# 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
WORKING_DIR: /home/runner/work/po-angular/po-angular/po-angular
on:
workflow_dispatch:
inputs:
version-beta:
description: Informe a versão do Beta do PO-UI
required: true
version-po-style:
description: Informe a versão do @po-ui/style
required: true
default: 'latest'
jobs:
build-and-publish:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/development'
steps:
- uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- 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: Update Version
run: node ./scripts/update-version.js ${{ github.event.inputs.version-beta }} ${{ github.event.inputs.version-po-style }}
working-directory: ${{env.WORKING_DIR}}
- name: Install and Build
run: npm install && npm run build
working-directory: ${{env.WORKING_DIR}}
# Pega as versões publicadas no NPM e salva no arquivo versions.json
- name: Obter todas as versões publicadas
run: npm show @${{ env.COMPONENTS_NPM_PATH }} versions --json > versions.json
# 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
# Verifica se a versão a ser publicada já existe no NPM
- name: Verificar se a versão existe
id: version
run: |
VERSION_TO_CHECK=${{ steps.package-version.outputs.current-version }}
if jq -e --arg version "$VERSION_TO_CHECK" '.[] | select(. == $version)' versions.json; then
echo "publish=no" >> "$GITHUB_OUTPUT"
else
echo "publish=yes" >> "$GITHUB_OUTPUT"
fi
# PUBLISH NG-SCHEMATICS
- name: ng-schematics - publish
if: contains(steps.version.outputs.publish, 'yes')
run: npm publish ${{env.WORKING_DIR}}/dist/ng-schematics --tag beta --ignore-scripts
env:
PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: ng-schematics - add "beta" tag
if: contains(steps.version.outputs.publish, 'no')
run: npm dist-tags add @${{ env.SCHEMATICS_NPM_PATH }}@${{ env.PACKAGE_VERSION }} "beta"
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(steps.version.outputs.publish, 'yes')
run: npm publish ${{env.WORKING_DIR}}/dist/ng-storage --tag beta --ignore-scripts
env:
PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: ng-storage - add "beta" tag
if: contains(steps.version.outputs.publish, 'no')
run: npm dist-tags add @${{ env.STORAGE_NPM_PATH }}@${{ env.PACKAGE_VERSION }} "beta"
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(steps.version.outputs.publish, 'yes')
run: npm publish ${{env.WORKING_DIR}}/dist/ng-sync --tag beta --ignore-scripts
env:
PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: ng-sync - add "beta" tag
if: contains(steps.version.outputs.publish, 'no')
run: npm dist-tags add @${{ env.SYNC_NPM_PATH }}@${{ env.PACKAGE_VERSION }} "beta"
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(steps.version.outputs.publish, 'yes')
run: npm publish ${{env.WORKING_DIR}}/dist/ng-components --tag beta --ignore-scripts
env:
PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: ng-components - add "beta" tag
if: contains(steps.version.outputs.publish, 'no')
run: npm dist-tags add @${{ env.COMPONENTS_NPM_PATH }}@${{ env.PACKAGE_VERSION }} "beta"
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(steps.version.outputs.publish, 'yes')
run: npm publish ${{env.WORKING_DIR}}/dist/ng-templates --tag beta --ignore-scripts
env:
PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: ng-templates - add "beta" tag
if: contains(steps.version.outputs.publish, 'no')
run: npm dist-tags add @${{ env.TEMPLATES_NPM_PATH }}@${{ env.PACKAGE_VERSION }} "beta"
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(steps.version.outputs.publish, 'yes')
run: npm publish ${{env.WORKING_DIR}}/dist/ng-code-editor --tag beta --ignore-scripts
env:
PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: ng-code-editor - add "beta" tag
if: contains(steps.version.outputs.publish, 'no')
run: npm dist-tags add @${{ env.CODE_EDITOR_NPM_PATH }}@${{ env.PACKAGE_VERSION }} "beta"
working-directory: ${{env.WORKING_DIR}}
env:
PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}