Skip to content

Promote release

Promote release #318

Workflow file for this run

name: Promote release
on:
workflow_dispatch:
inputs:
version:
description: 'Version to promote (e.g.: 3.0.6-rc.6)'
required: true
referenceBranch:
description: 'Branch to be updated after the promotion'
required: true
default: 'maintenance-3.0.x'
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@v3
with:
node-version: 14
registry-url: 'https://packages.nuxeo.com/repository/npm-public/'
scope: '@nuxeo'
- uses: actions/checkout@v2
with:
ref: v${{ github.event.inputs.version }}
- 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 Web UI version to ${{ env.VERSION }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
OLD_VERSION=$(npx -c 'echo "$npm_package_version"')
npm version $VERSION --no-git-tag-version
pushd packages/nuxeo-web-ui-ftest/
npm version $VERSION --no-git-tag-version
popd
find . -type f -not -path "./node_modules/*" -regex ".*\.\(yaml\|sample\|xml\)" -exec sed -i 's/'"$OLD_VERSION"'/'"$VERSION"'/g' {} \;
# XXX: undo the padded lock (see WEBUI-140)
sed -i -e 's/<webui.package.version>.*<\/webui.package.version>/<webui.package.version>${project.version}<\/webui.package.version>/g' plugin/web-ui/marketplace/pom.xml
# align on same promoted version of elements
npm i @nuxeo/nuxeo-elements@$VERSION --save-exact
npm i @nuxeo/nuxeo-dataviz-elements@$VERSION --save-exact
npm i @nuxeo/nuxeo-ui-elements@$VERSION --save-exact
npm i @nuxeo/testing-helpers@$VERSION --save-exact
- name: Perform git release of Nuxeo Web 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: Publish Nuxeo Web UI FTest ${{ env.VERSION }}
if: ${{ github.event.inputs.dryRun == 'false' }}
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/
popd
- name: Promote Web UI ${{ github.event.inputs.version }} to ${{ env.VERSION }}
env:
PACKAGE: nuxeo-web-ui-${{ 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-web-ui/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 Web UI to Connect PREPROD
if: ${{ github.event.inputs.dryRun == 'false' }}
env:
PACKAGE: nuxeo-web-ui-${{ 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 Web UI to Connect PROD
if: ${{ github.event.inputs.dryRun == 'false' }}
env:
PACKAGE: nuxeo-web-ui-${{ 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@v2
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: |
echo "OLD_SNAPSHOT=$(npx -c 'echo "$npm_package_version"')" >> $GITHUB_ENV
# bump version to next SNAPSHOT and align on the corresponding Elements release candidate
NEW_SNAPSHOT=$NEW_VERSION-SNAPSHOT
npm version $NEW_SNAPSHOT --no-git-tag-version
pushd packages/nuxeo-web-ui-ftest/
npm version $NEW_SNAPSHOT --no-git-tag-version
popd
- if: ${{ github.event.inputs.referenceBranch == 'master' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
NEW_ELEMENTS_VERSION="^$NEW_VERSION-rc"
npm i @nuxeo/nuxeo-elements@$NEW_ELEMENTS_VERSION --save-prefix="^"
npm i @nuxeo/nuxeo-dataviz-elements@$NEW_ELEMENTS_VERSION --save-prefix="^"
npm i @nuxeo/nuxeo-ui-elements@$NEW_ELEMENTS_VERSION --save-prefix="^"
npm i @nuxeo/testing-helpers@$NEW_ELEMENTS_VERSION --save-prefix="^"
- if: ${{ github.event.inputs.referenceBranch != 'master' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
NEW_ELEMENTS_VERSION="~$NEW_VERSION-rc"
npm i @nuxeo/nuxeo-elements@$NEW_ELEMENTS_VERSION --save-prefix="~"
npm i @nuxeo/nuxeo-dataviz-elements@$NEW_ELEMENTS_VERSION --save-prefix="~"
npm i @nuxeo/nuxeo-ui-elements@$NEW_ELEMENTS_VERSION --save-prefix="~"
npm i @nuxeo/testing-helpers@$NEW_ELEMENTS_VERSION --save-prefix="~"
- run: |
NEW_SNAPSHOT="$NEW_VERSION-SNAPSHOT"
find . -type f -not -path "./node_modules/*" -regex ".*\.\(yaml\|sample\|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 }}