[ACA-4653] Migrate release workflow to GHA (#3027)

* [ACA-4653] Run ACA upstream on schedule

* [ACA-4653] Migrate release workflow to GHA

* [ACA-4653] Consistency in naming

* [ACA-4653] Use GH action to configure GH author

* [ACA-4653] Dedicated sh for publish Docker image job

* [ACA-4653] Add missing variables

* [ACA-4653] Delete Travis.yml

* [ACA-4653] CR fixes

* [ACA-4653] Add branch name as action input

* [ACA-4653] Proper env var usage in workflow
This commit is contained in:
MichalKinas
2023-03-03 12:40:37 -05:00
committed by GitHub
parent 3294606fc0
commit e38e72a8e0
10 changed files with 394 additions and 129 deletions
+112
View File
@@ -0,0 +1,112 @@
name: "Publish ACA libs to NPM and GH registry"
description: "Publish ACA libs to NPM and GH registry"
inputs:
github_token:
description: 'Github token'
required: true
type: string
npm-registry-address:
description: 'NPM registry address'
required: true
type: string
npm-registry-token:
description: 'NPM registry token'
required: true
type: string
dry-run:
description: dry run flag
required: true
type: boolean
runs:
using: "composite"
steps:
- name: update libs version
shell: bash
run: |
ROOT_DIR=./../../..
export DIST_DIR=./dist/@alfresco
PROJECTS_DIR=./projects
VERSION_IN_PACKAGE_JSON=$(node -p "require('$ROOT_DIR/package.json').version;")
if [[ $TRAVIS_BRANCH =~ ^master.*?$ ]] ; then
NEW_LIBRARY_VERSION=VERSION_IN_PACKAGE_JSON
else
NEW_LIBRARY_VERSION="${VERSION_IN_PACKAGE_JSON}-${{ github.run_id }}"
fi
echo -e "Branch is '$BRANCH_NAME', therefore publish with '$TAG_NPM' tag\n"
export PROJECTS=(
'aca-shared'
'aca-folder-rules'
'adf-office-services-ext'
'aca-about'
'aca-preview'
'aca-viewer'
'aca-content'
);
for PROJECT in "${PROJECTS[@]}"; do
echo "Update ${PROJECT} version to ${NEW_LIBRARY_VERSION}"
cd $PROJECTS_DIR/${PROJECT}
if [[ ${{ inputs.dry-run }} == false ]]; then
npm version ${NEW_LIBRARY_VERSION}
fi
done
echo -e "\n\nBuild projects"
cd ${ROOT_DIR}
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
shell: bash
run: |
for PROJECT in "${PROJECTS[@]}"
do
cd $DIST_DIR/${PROJECT}
if [[ ${{ inputs.dry-run }} == false ]]; then
echo -e "Publish with dry mode for project to GH registry: $PROJECT\n"
echo -e "npm publish --dry-run --tag $TAG_NPM \n"
npm publish --dry-run --tag $TAG_NPM
else
echo -e "======== Publishing project to GH registry: $PROJECT ========\n"
echo -e "npm publish --tag $TAG_NPM\n"
npm publish --tag $TAG_NPM
fi
done
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
shell: bash
run: |
for PROJECT in "${PROJECTS[@]}"
do
cd $DIST_DIR/${PROJECT}
if [[ ${{ inputs.dry-run }} == false ]]; then
echo -e "Publish with dry mode for project to NPM registry: $PROJECT\n"
echo -e "npm publish --dry-run --tag $TAG_NPM \n"
npm publish --dry-run --tag $TAG_NPM
else
echo -e "======== Publishing project to NPM registry: $PROJECT ========\n"
echo -e "npm publish --tag $TAG_NPM\n"
npm publish --tag $TAG_NPM
fi
done
env:
NODE_AUTH_TOKEN: ${{ inputs.npm-registry-token }}