-
Notifications
You must be signed in to change notification settings - Fork 1
132 lines (108 loc) · 5.54 KB
/
promote.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
name: Promote release
on:
workflow_dispatch:
inputs:
version:
description: 'Version to promote (e.g.: 24.0.1-rc.2)'
required: true
referenceBranch:
description: 'Branch to be updated after the promotion'
required: true
default: 'dev-test-1'
dryRun:
description: 'Run the workflow without pushing code or publishing artifacts'
type: boolean
required: false
jobs:
promote:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v4
with:
registry-url: 'https://packages.nuxeo.com/repository/npm-public/'
node-version: 20
scope: '@nuxeo'
- uses: actions/checkout@v4
with:
ref: v${{ github.event.inputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
- run: git config user.name "nuxeo-webui-jx-bot" && git config user.email "[email protected]"
- run: echo "VERSION=$(echo '${{ github.event.inputs.version }}' | sed -e 's/-rc.[0-9]*//')" >> $GITHUB_ENV
- name: Update Nuxeo Admin Console UI version to ${{ env.VERSION }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
pushd nuxeo-admin-console-web/angular-app
OLD_VERSION=$(npx -c 'echo "$npm_package_version"')
npm version $VERSION --no-git-tag-version
popd
find . -type f -not -path "./node_modules/*" -regex ".*\.\(yaml\|sample\|json\|xml\)" -exec sed -i 's/'"$OLD_VERSION"'/'"$VERSION"'/g' {} \;
# XXX: undo the padded lock (see WEBUI-140)
sed -i -e 's/<nuxeoadmin.package.version>.*<\/nuxeoadmin.package.version>/<nuxeoadmin.package.version>${project.version}<\/nuxeoadmin.package.version>/g' nuxeo-admin-console-package/pom.xml
- name: Perform git release of Nuxeo Admin Console UI ${{ env.VERSION }}
run: |
git commit -a -m "Release $VERSION"
git tag -a v$VERSION -m "Release $VERSION"
- if: ${{ github.event.inputs.dryRun == 'false' }}
run: git push origin v$VERSION
- name: Create Github release v${{ env.VERSION }}
if: ${{ github.event.inputs.dryRun == 'false' }}
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.VERSION }}
release_name: Release ${{ env.VERSION }}
- name: Promote Admin Console UI ${{ github.event.inputs.version }} to ${{ env.VERSION }}
env:
PACKAGE: nuxeo-admin-console-package-${{ env.VERSION }}
CONNECT_PREPROD_URL: https://nos-preprod-connect.nuxeocloud.com/nuxeo
run: |
PADDED=$(printf '%03d' $(echo ${{ github.event.inputs.version }} | sed -r s/[0-9]+\.[0-9]+\.[0-9]+-rc\.\([0-9]+\)/\\1/g))
PADDED_VERSION=$(echo ${{ github.event.inputs.version }} | sed -E "s/([0-9]+\.[0-9]+\.[0-9]+-rc\.)[0-9]+/\\1$PADDED/g")
curl -o $PACKAGE.zip -L -u "${{ secrets.CONNECT_PREPROD_AUTH }}" "$CONNECT_PREPROD_URL/site/marketplace/package/nuxeo-admin-console-ui-package/download?version=$PADDED_VERSION"
unzip -d $PACKAGE $PACKAGE.zip && rm $PACKAGE.zip
pushd $PACKAGE
sed -i 's/-rc.[0-9]*//' package.xml
for f in install/bundles/*.jar; do mv $f $(echo $f | sed -e 's/-rc.[0-9]*//'); done
zip -r ../$PACKAGE.zip .
popd
- name: Push promoted Admin Console UI to Connect PREPROD
if: ${{ github.event.inputs.dryRun == 'false' }}
env:
PACKAGE: nuxeo-admin-console-ui-package-${{ env.VERSION }}
CONNECT_PREPROD_URL: https://nos-preprod-connect.nuxeocloud.com/nuxeo
run: curl -i -u "${{ secrets.CONNECT_PREPROD_AUTH }}" -F package=@$PACKAGE.zip "$CONNECT_PREPROD_URL/site/marketplace/upload?batch=true"
- name: Push promoted Admin Console UI to Connect PROD
if: ${{ github.event.inputs.dryRun == 'false' }}
env:
PACKAGE: nuxeo-admin-console-ui-package-${{ env.VERSION }}
CONNECT_URL: https://connect.nuxeo.com/nuxeo
run: curl -i -u "${{ secrets.CONNECT_AUTH }}" -F package=@$PACKAGE.zip "$CONNECT_URL/site/marketplace/upload?batch=true"
- uses: actions/checkout@v4
with:
token: ${{ secrets.GIT_ADMIN_TOKEN }}
ref: ${{ github.event.inputs.referenceBranch }}
- if: ${{ github.event.inputs.referenceBranch == 'master' }}
run: echo "NEW_VERSION=$(npx semver -i minor $VERSION)" >> $GITHUB_ENV
- if: ${{ github.event.inputs.referenceBranch != 'master' }}
run: echo "NEW_VERSION=$(npx semver -i patch $VERSION)" >> $GITHUB_ENV
- name: Align ${{ github.event.inputs.referenceBranch }} branch on next version ${{ env.NEW_VERSION }}-SNAPSHOT
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
pushd nuxeo-admin-console-web/angular-app
echo "OLD_SNAPSHOT=$(npx -c 'echo "$npm_package_version"')" >> $GITHUB_ENV
popd
# bump version to next SNAPSHOT
NEW_SNAPSHOT=$NEW_VERSION-SNAPSHOT
pushd nuxeo-admin-console-web/angular-app
npm version $NEW_SNAPSHOT --no-git-tag-version
popd
- run: |
NEW_SNAPSHOT="$NEW_VERSION-SNAPSHOT"
find . -type f -not -path "./node_modules/*" -regex ".*\.\(yaml\|sample\|json\|xml\)" -exec sed -i 's/'"$OLD_SNAPSHOT"'/'"$NEW_SNAPSHOT"'/g' {} \;
# commit and push
git commit -a -m "Update $OLD_SNAPSHOT to $NEW_SNAPSHOT"
- if: ${{ github.event.inputs.dryRun == 'false' }}
run: git push origin ${{ github.event.inputs.referenceBranch }}