release workflow fixes (#3045)

This commit is contained in:
Denys Vuika
2023-03-07 13:32:06 -05:00
committed by GitHub
parent 4292f0fbc0
commit 6f309a0c1e
2 changed files with 44 additions and 22 deletions

View File

@@ -30,25 +30,14 @@ inputs:
runs: runs:
using: "composite" using: "composite"
steps: steps:
- run: npm ci - uses: ./.github/actions/update-library-versions
name: Update Library Versions
with:
dry-run: ${{ inputs.dry-run }}
- name: Build Libraries
shell: bash shell: bash
- name: Update Library Versions run: npm ci && npm run build-libs
shell: bash
run: |
VERSION_IN_PACKAGE_JSON=$(jq -cr '.version' < package.json)
if [[ ${{ inputs.branch_name }} =~ ^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 '${{ inputs.branch_name }}, therefore publish with '${{ inputs.npm_tag }}' tag\n"
./scripts/gh/update-lib-versions.sh "$NEW_LIBRARY_VERSION" "${{ inputs.dry-run }}"
echo "Building projects"
npm run build-libs
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
name: setup GH registry name: setup GH registry
@@ -56,11 +45,14 @@ runs:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
registry-url: 'https://npm.pkg.github.com' registry-url: 'https://npm.pkg.github.com'
scope: '@alfresco' scope: '@alfresco'
- name: Publish to GH registry - name: Publish to GH registry
shell: bash shell: bash
run: ./scripts/gh/npm-publish.sh "${{ inputs.npm_tag }}" "${{ inputs.dry-run }}" run: ./scripts/gh/npm-publish.sh "$TAG" "$DRY_RUN"
env: env:
NODE_AUTH_TOKEN: ${{ inputs.github_token }} NODE_AUTH_TOKEN: ${{ inputs.github_token }}
TAG: ${{ inputs.npm_tag }}
DRY_RUN: ${{ inputs.dry-run }}
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
name: setup NPM registry name: setup NPM registry
@@ -68,8 +60,11 @@ runs:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
registry-url: 'https://${{ inputs.npm_registry_address }}' registry-url: 'https://${{ inputs.npm_registry_address }}'
scope: '@alfresco' scope: '@alfresco'
- name: Publish to NPM registry - name: Publish to NPM registry
shell: bash shell: bash
run: ./scripts/gh/npm-publish.sh "${{ inputs.npm_tag }}" "${{ inputs.dry-run }}" run: ./scripts/gh/npm-publish.sh "$TAG" "$DRY_RUN"
env: env:
NODE_AUTH_TOKEN: ${{ inputs.npm_registry_token }} NODE_AUTH_TOKEN: ${{ inputs.npm_registry_token }}
TAG: ${{ inputs.npm_tag }}
DRY_RUN: ${{ inputs.dry-run }}

View File

@@ -0,0 +1,27 @@
name: "Update Library Versions"
description: "Updates ACA libraries according to the root Version"
inputs:
dry-run:
description: dry run flag
required: true
type: boolean
runs:
using: "composite"
steps:
- name: Update Versions
shell: bash
run: |
VERSION_IN_PACKAGE_JSON=$(jq -cr '.version' < package.json)
if [[ ${{ inputs.branch_name }} =~ ^master.*?$ ]] ; then
NEW_LIBRARY_VERSION="$VERSION_IN_PACKAGE_JSON"
else
NEW_LIBRARY_VERSION="${VERSION_IN_PACKAGE_JSON}-${{ github.run_id }}"
fi
./scripts/gh/update-lib-versions.sh "$NEW_LIBRARY_VERSION" "${{ inputs.dry-run }}"
echo "Building projects"
npm run build-libs