[ACA-4649] release workflow enhancements (#3043)

* move update versions of libs to shell script

* unify packaging script

* update package.json repository

* change github token
This commit is contained in:
Denys Vuika 2023-03-07 11:12:57 -05:00 committed by GitHub
parent 0b55af2c32
commit 4933b1db42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 79 additions and 78 deletions

View File

@ -32,11 +32,9 @@ runs:
steps:
- run: npm ci
shell: bash
- name: update libs version
- name: Update Library Versions
shell: bash
run: |
DIST_DIR="./dist/@alfresco"
PROJECTS_DIR="./projects"
VERSION_IN_PACKAGE_JSON=$(jq -cr '.version' < package.json)
if [[ ${{ inputs.branch_name }} =~ ^master.*?$ ]] ; then
@ -47,97 +45,31 @@ runs:
echo -e "Branch is '${{ inputs.branch_name }}, therefore publish with '${{ inputs.npm_tag }}' tag\n"
export PROJECTS=(
'aca-shared'
'aca-folder-rules'
'adf-office-services-ext'
'aca-about'
'aca-preview'
'aca-viewer'
'aca-content'
);
./scripts/gh/update-lib-versions.sh "$NEW_LIBRARY_VERSION" "${{ inputs.dry-run }}"
for PROJECT in ${PROJECTS[@]}
do
echo "Update \"$PROJECT\" to version \"$NEW_LIBRARY_VERSION\""
if [[ "${{ inputs.dry-run }}" != "true" ]]; then
(cd $PROJECTS_DIR/${PROJECT} && npm version --allow-same-version --no-git-tag-version --force "$NEW_LIBRARY_VERSION")
fi
done
echo -e "\n\nBuild projects"
echo "Building projects"
npm run build-libs
- uses: actions/setup-node@v3
name: setup GH registry
with:
node-version-file: '.nvmrc'
registry-url: 'https://npm.pkg.github.com'
scope: '@alfresco'
- name: publish tag to GH registry
- name: Publish to GH registry
shell: bash
run: |
DIST_DIR="./dist/@alfresco"
export PROJECTS=(
'aca-shared'
'aca-folder-rules'
'adf-office-services-ext'
'aca-about'
'aca-preview'
'aca-viewer'
'aca-content'
);
for PROJECT in ${PROJECTS[@]}
do
cd $DIST_DIR/${PROJECT}
if [[ "${{ inputs.dry-run }}" == "true" ]]; then
echo -e "Publish with dry mode for project to GH registry: $PROJECT\n"
echo -e "npm publish --dry-run --tag ${{ inputs.npm_tag }} \n"
npm publish --dry-run --tag ${{ inputs.npm_tag }}
else
echo -e "======== Publishing project to GH registry: $PROJECT ========\n"
echo -e "npm publish --tag ${{ inputs.npm_tag }}\n"
npm publish --tag ${{ inputs.npm_tag }}
fi
done
run: ./scripts/gh/npm-publish.sh "${{ inputs.npm_tag }}" "${{ inputs.dry-run }}"
env:
NODE_AUTH_TOKEN: ${{ inputs.github_token }}
- uses: actions/setup-node@v3
name: setup NPM registry
with:
node-version-file: '.nvmrc'
registry-url: ${{ inputs.npm_registry_address }}
scope: '@alfresco'
- name: publish tag to NPM registry
- name: Publish to NPM registry
shell: bash
run: |
DIST_DIR="./dist/@alfresco"
export PROJECTS=(
'aca-shared'
'aca-folder-rules'
'adf-office-services-ext'
'aca-about'
'aca-preview'
'aca-viewer'
'aca-content'
);
for PROJECT in ${PROJECTS[@]}
do
cd $DIST_DIR/${PROJECT}
if [[ "${{ inputs.dry-run }}" == "true" ]]; then
echo -e "Publish with dry mode for project to NPM registry: $PROJECT\n"
echo -e "npm publish --dry-run --tag ${{ inputs.npm_tag }} \n"
npm publish --dry-run --tag ${{ inputs.npm_tag }}
else
echo -e "======== Publishing project to NPM registry: $PROJECT ========\n"
echo -e "npm publish --tag ${{ inputs.npm_tag }}\n"
npm publish --tag ${{ inputs.npm_tag }}
fi
done
run: ./scripts/gh/npm-publish.sh "${{ inputs.npm_tag }}" "${{ inputs.dry-run }}"
env:
NODE_AUTH_TOKEN: ${{ inputs.npm_registry_token }}

View File

@ -136,7 +136,7 @@ jobs:
uses: ./.github/actions/publish-libs
with:
branch_name: ${{ env.BRANCH_NAME }}
github_token: ${{ secrets.GITHUB_TOKEN }}
github_token: ${{ secrets.BOT_GITHUB_TOKEN }}
npm_registry_address: ${{ vars.NPM_REGISTRY_ADDRESS }}
npm_registry_token: ${{ secrets.NPM_REGISTRY_TOKEN }}
npm_tag: ${{ env.TAG_NPM }}

View File

@ -25,6 +25,10 @@
"inspect.bundle": "ng build content-ce --configuration production --stats-json && npx webpack-bundle-analyzer dist/content-ce/stats.json",
"prepare": "husky install"
},
"repository": {
"type": "git",
"url": "https://github.com/Alfresco/alfresco-content-app.git"
},
"private": true,
"dependencies": {
"@alfresco/adf-content-services": "6.0.0-A.3",

34
scripts/gh/npm-publish.sh Executable file
View File

@ -0,0 +1,34 @@
#!/usr/bin/env bash
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd )"
DIST_DIR="$ROOT_DIR/dist/@alfresco"
TAG=$1
DRY_RUN=$2
if [[ -z "$TAG" ]]; then
echo "Missing tag parameter"
exit 1
fi
export PROJECTS=(
'aca-about'
'aca-content'
'aca-folder-rules'
'adf-office-services-ext'
'aca-preview'
'aca-shared'
'aca-viewer'
);
for PROJECT in ${PROJECTS[@]}
do
cd $DIST_DIR/$PROJECT
if [[ "$DRY_RUN" == "true" ]]; then
echo "[DRY RUN] Publishing \"$PROJECT\" with \"$TAG\" tag"
npm publish --dry-run --tag "$TAG"
else
echo "Publishing \"$PROJECT\" with \"$TAG\" tag"
npm publish --tag "$TAG"
fi
done

View File

@ -0,0 +1,31 @@
#!/usr/bin/env bash
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd )"
VERSION=$1
DRY_RUN=$2
if [[ -z "$VERSION" ]]; then
echo "Missing version parameter"
exit 1
fi
export PROJECTS=(
'aca-about'
'aca-content'
'aca-folder-rules'
'adf-office-services-ext'
'aca-preview'
'aca-shared'
'aca-viewer'
);
for PROJECT in ${PROJECTS[@]}
do
echo "Updating \"$PROJECT\" to version \"$VERSION\""
if [[ "$DRY_RUN" != "true" ]]; then
PROJECT_DIR=$ROOT_DIR/projects/$PROJECT
(cd $PROJECT_DIR && npm version --allow-same-version --no-git-tag-version --force "$VERSION")
fi
done