-
Notifications
You must be signed in to change notification settings - Fork 60
152 lines (130 loc) · 5.11 KB
/
main.yaml
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
name: Main
on:
push:
branches:
- maintenance-3.0.x
# Manually trigger the workflow
workflow_dispatch:
jobs:
lint:
uses: nuxeo/nuxeo-web-ui/.github/workflows/[email protected]
secrets:
NPM_PACKAGES_TOKEN: ${{ secrets.NPM_PACKAGES_TOKEN }}
test:
uses: nuxeo/nuxeo-web-ui/.github/workflows/[email protected]
secrets:
NPM_PACKAGES_TOKEN: ${{ secrets.NPM_PACKAGES_TOKEN }}
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
with:
branch: maintenance-3.0.x
a11y:
uses: nuxeo/nuxeo-web-ui/.github/workflows/[email protected]
secrets:
NPM_PACKAGES_TOKEN: ${{ secrets.NPM_PACKAGES_TOKEN }}
PACKAGES_AUTH_USER: ${{ secrets.PACKAGES_AUTH_USER }}
PACKAGES_AUTH_TOKEN: ${{ secrets.PACKAGES_AUTH_TOKEN }}
with:
branch: maintenance-3.0.x
ftest:
uses: nuxeo/nuxeo-web-ui/.github/workflows/[email protected]
secrets:
NPM_PACKAGES_TOKEN: ${{ secrets.NPM_PACKAGES_TOKEN }}
PACKAGES_AUTH_USER: ${{ secrets.PACKAGES_AUTH_USER }}
PACKAGES_AUTH_TOKEN: ${{ secrets.PACKAGES_AUTH_TOKEN }}
with:
branch: maintenance-3.0.x
build:
needs: [ lint, test, a11y, ftest ]
runs-on: [ self-hosted, master ]
steps:
- uses: actions/checkout@v2
- run: git config user.name "nuxeo-webui-jx-bot" && git config user.email "[email protected]"
- uses: actions/setup-node@v3
with:
registry-url: 'https://packages.nuxeo.com/repository/npm-public/'
scope: '@nuxeo'
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
- name: Prepare environment
run: |
echo "BRANCH_NAME=${GITHUB_HEAD_REF##*/}" >> $GITHUB_ENV
echo "PACKAGE_VERSION=$(npx -c 'echo "$npm_package_version"')" >> $GITHUB_ENV
- name: Get prerelease version
run: |
git fetch origin --tags
RC_VERSION=$(git tag --sort=taggerdate --list "v${PACKAGE_VERSION/-SNAPSHOT}*" | tail -1 | tr -d '\n')
echo "VERSION=$(npx semver -i prerelease --preid rc ${RC_VERSION:-$PACKAGE_VERSION} | tr -d '\n')" >> $GITHUB_ENV
- name: Update versions
run: |
find . -type f -not -path "./node_modules/*" -regex ".*\.\(yaml\|sample\|xml\)" -exec sed -i 's/'"$PACKAGE_VERSION"'/'"$VERSION"'/g' {} \;
# set padded version to build package for connect preprod
PADDED=$(printf '%03d' $(echo $VERSION | sed -r s/[0-9]+\.[0-9]+\.[0-9]+-rc\.\([0-9]+\)/\\1/g))
PADDED_VERSION=$(echo $VERSION | sed -E "s/([0-9]+\.[0-9]+\.[0-9]+-rc\.)[0-9]+/\\1$PADDED/g")
echo "PADDED_VERSION=$PADDED_VERSION" >> $GITHUB_ENV
sed -i -e 's/\${project.version}/'"$PADDED_VERSION"'/g' plugin/web-ui/marketplace/pom.xml
npm version ${VERSION} --no-git-tag-version
pushd packages/nuxeo-web-ui-ftest
npm version ${VERSION} --no-git-tag-version
popd
- name: Install
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm install
pushd packages/nuxeo-web-ui-ftest
npm install
popd
pushd packages/nuxeo-designer-catalog
npm install
popd
- name: 'Update settings.xml with server configuration'
run: |
echo '<settings>
<servers>
<server>
<id>maven-internal</id>
<username>${{ secrets.PACKAGES_AUTH_USER }}</username>
<password>${{ secrets.PACKAGES_AUTH_TOKEN }}</password>
</server>
</servers>
</settings>' > ~/.m2/settings.xml
- name: Nuxeo package build
run: |
mvn -ntp install -DskipInstall
mvn -B -nsu -ntp -f plugin/itests/addon install
mvn -B -nsu -ntp -f plugin/itests/marketplace install
- name: Archive packages
uses: actions/upload-artifact@v2
with:
name: packages
path: |
plugin/web-ui/marketplace/target/nuxeo-web-ui-marketplace-*.zip
plugin/itests/marketplace/target/nuxeo-web-ui-marketplace-itests-*.zip
- name: Tag
run: |
git add package-lock.json packages/nuxeo-web-ui-ftest/package-lock.json
git commit -a -m "Release ${VERSION}"
git tag -a v${VERSION} -m "Release ${VERSION}"
git push origin v${VERSION}
- name: Publish Nuxeo packages
env:
CONNECT_PREPROD_URL: https://nos-preprod-connect.nuxeocloud.com/nuxeo
run: |
PACKAGE="plugin/web-ui/marketplace/target/nuxeo-web-ui-marketplace-${PADDED_VERSION}.zip"
STATUS_CODE=`curl -i --silent --output publish-req.output -w "%{http_code}" -u "${{ secrets.CONNECT_PREPROD_AUTH }}" -F package=@$PACKAGE "$CONNECT_PREPROD_URL/site/marketplace/upload?batch=true"`
cat publish-req.output
if [[ "$STATUS_CODE" != "200" ]]
then
exit 1
else
exit 0
fi
- name: Publish Web UI FTest framework
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
pushd packages/nuxeo-web-ui-ftest/
npm publish --@nuxeo:registry=https://packages.nuxeo.com/repository/npm-public/ --tag SNAPSHOT
popd