mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
[ACS-7241] Support parallel releases (#4297)
* [ACS-7241] Parallel releases support v1 * [ACS-7241] Add missing needs clauses * [ACS-7241] Proper conditional job check * [ACS-7241] Revert testing changes, namespace fix * [ACS-7241] Add improved conditions
This commit is contained in:
parent
436127edb2
commit
d88bf8ce3e
2
.github/actions/get-image-tag/action.yml
vendored
2
.github/actions/get-image-tag/action.yml
vendored
@ -12,7 +12,7 @@ runs:
|
||||
- name: Get docker image tag name
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ "${{ inputs.branch_name }}" == "master" ]]; then
|
||||
if [[ "${{ inputs.branch_name }}" == "master" ]] || [[ "${{ inputs.branch_name }}" == release/* ]]; then
|
||||
TAG_VERSION="$(jq -cr '.version' < package.json)"
|
||||
else
|
||||
TAG_VERSION="${{ inputs.branch_name }}-${{ github.run_id }}"
|
||||
|
2
.github/actions/git-tag/action.yml
vendored
2
.github/actions/git-tag/action.yml
vendored
@ -18,7 +18,7 @@ runs:
|
||||
- name: publish tag
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ "${{ inputs.branch_name }}" == "master" ]]; then
|
||||
if [[ "${{ inputs.branch_name }}" == "master" ]] || [[ "${{ inputs.branch_name }}" == release/* ]]; then
|
||||
VERSION=$(jq -cr '.version' < package.json)
|
||||
echo "git tag -a ${VERSION} -m ${VERSION}"
|
||||
|
||||
|
12
.github/actions/setup/action.yml
vendored
12
.github/actions/setup/action.yml
vendored
@ -1,6 +1,12 @@
|
||||
name: "Variables setup"
|
||||
description: "Variables setup"
|
||||
|
||||
inputs:
|
||||
npm_tag:
|
||||
description: 'NPM tag'
|
||||
required: false
|
||||
type: string
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
@ -17,12 +23,15 @@ runs:
|
||||
- name: set TAG_NPM
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ -n "${{ inputs.npm_tag }}" ]]; then
|
||||
TAG_NPM=${{ inputs.npm_tag }}
|
||||
else
|
||||
TAG_NPM="alpha"
|
||||
VERSION_IN_PACKAGE_JSON=$(jq -cr '.version' < package.json)
|
||||
|
||||
echo "version in package.json=${VERSION_IN_PACKAGE_JSON}"
|
||||
|
||||
if [[ $BRANCH_NAME =~ ^master(-patch.*)?$ ]]; then
|
||||
if [[ $BRANCH_NAME =~ ^master(-patch.*)?$ ]] || [[ $BRANCH_NAME == release/* ]]; then
|
||||
# Pre-release versions
|
||||
if [[ $VERSION_IN_PACKAGE_JSON =~ ^[0-9]*\.[0-9]*\.[0-9]*-A\.[0-9]*$ ]];
|
||||
then
|
||||
@ -36,4 +45,5 @@ runs:
|
||||
if [[ $BRANCH_NAME =~ ^develop(-patch.*)?$ ]]; then
|
||||
TAG_NPM=alpha
|
||||
fi
|
||||
fi
|
||||
echo "TAG_NPM=${TAG_NPM}" >> $GITHUB_ENV
|
||||
|
87
.github/workflows/release-branch.yml
vendored
87
.github/workflows/release-branch.yml
vendored
@ -1,87 +0,0 @@
|
||||
name: Release ACA libs from branch
|
||||
run-name: Release ACA libs from branch ${{ github.ref_name }}
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
dry-run-flag:
|
||||
description: 'enable dry-run'
|
||||
required: false
|
||||
type: boolean
|
||||
default: true
|
||||
|
||||
env:
|
||||
BASE_URL: ${{ secrets.PIPELINE_ENV_URL }}
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: 'lint'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
- run: npm ci
|
||||
- run: npm run affected:lint -- --base=origin/develop
|
||||
- run: npm run stylelint
|
||||
|
||||
unit-tests:
|
||||
needs: [lint]
|
||||
name: "Unit tests: ${{ matrix.unit-tests.name }}"
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
unit-tests:
|
||||
- name: "aca-content"
|
||||
- name: "aca-shared"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
- uses: ./.github/actions/before-install
|
||||
- run: npm ci
|
||||
- run: npm run affected:test -- --browsers=ChromeHeadless --watch=false $TEST_OPTS --base=origin/develop
|
||||
|
||||
publish-libs:
|
||||
needs: [lint, unit-tests]
|
||||
name: "Publish libs to NPM and GitHub registry"
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
packages: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-branch-name@v8.16.0
|
||||
|
||||
- name: publish
|
||||
uses: ./.github/actions/publish-libs
|
||||
with:
|
||||
branch_name: ${{ env.BRANCH_NAME }}
|
||||
github_token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
npm_registry_token: ${{ secrets.NPM_REGISTRY_TOKEN }}
|
||||
npm_tag: 'branch'
|
||||
dry-run: ${{ inputs.dry-run-flag }}
|
100
.github/workflows/release.yml
vendored
100
.github/workflows/release.yml
vendored
@ -1,10 +1,36 @@
|
||||
name: "Release"
|
||||
name: Release workflow
|
||||
run-name: Release workflow triggered from ${{ github.ref_name }} branch
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
publish-to-docker:
|
||||
description: 'Publish to Docker'
|
||||
required: false
|
||||
type: boolean
|
||||
default: true
|
||||
publish-to-quay:
|
||||
description: 'Publish to Quay'
|
||||
required: false
|
||||
type: boolean
|
||||
default: true
|
||||
publish-to-npm:
|
||||
description: 'Publish NPM libraries'
|
||||
required: false
|
||||
type: boolean
|
||||
default: true
|
||||
publish-git-tag:
|
||||
description: 'Publish Git Tag'
|
||||
required: false
|
||||
type: boolean
|
||||
default: true
|
||||
npm-tag:
|
||||
description: 'NPM tag that libraries will be published with'
|
||||
required: false
|
||||
type: string
|
||||
default: ''
|
||||
dry-run-release:
|
||||
description: 'enable dry-run'
|
||||
description: 'Enable dry-run'
|
||||
required: false
|
||||
type: boolean
|
||||
default: true
|
||||
@ -12,6 +38,7 @@ on:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
- release/**
|
||||
|
||||
env:
|
||||
BASE_URL: ${{ secrets.PIPELINE_ENV_URL }}
|
||||
@ -20,7 +47,56 @@ env:
|
||||
PLAYWRIGHT_E2E_HOST: ${{ secrets.PLAYWRIGHT_E2E_HOST }}
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
name: 'lint'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
- run: npm ci
|
||||
- run: npm run affected:lint -- --base=origin/develop
|
||||
- run: npm run stylelint
|
||||
|
||||
unit-tests:
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
needs: [lint]
|
||||
name: "Unit tests: ${{ matrix.unit-tests.name }}"
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
unit-tests:
|
||||
- name: "aca-content"
|
||||
- name: "aca-shared"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
- uses: ./.github/actions/before-install
|
||||
- run: npm ci
|
||||
- run: npm run affected:test -- --browsers=ChromeHeadless --watch=false $TEST_OPTS --base=origin/develop
|
||||
|
||||
publish-docker-registry:
|
||||
if: |
|
||||
always() &&
|
||||
(${{ inputs.publish-to-quay == 'true' }} && (needs.unit-tests.result == 'success' || needs.unit-tests.result == 'skipped'))
|
||||
needs: [lint, unit-tests]
|
||||
name: "Publish to Quay"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@ -34,6 +110,8 @@ jobs:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
- uses: ./.github/actions/setup
|
||||
with:
|
||||
npm_tag: ${{ inputs.npm-tag }}
|
||||
|
||||
- name: Get Tag
|
||||
uses: ./.github/actions/get-image-tag
|
||||
@ -50,6 +128,10 @@ jobs:
|
||||
dry-run: ${{ inputs.dry-run-release }}
|
||||
|
||||
publish-to-dockerhub:
|
||||
if: |
|
||||
always() &&
|
||||
(${{ inputs.publish-to-docker == 'true' }} && (needs.unit-tests.result == 'success' || needs.unit-tests.result == 'skipped'))
|
||||
needs: [lint, unit-tests]
|
||||
name: "Publish to Dockerhub"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@ -63,6 +145,8 @@ jobs:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
- uses: ./.github/actions/setup
|
||||
with:
|
||||
npm_tag: ${{ inputs.npm-tag }}
|
||||
|
||||
- name: Get Tag
|
||||
uses: ./.github/actions/get-image-tag
|
||||
@ -79,6 +163,10 @@ jobs:
|
||||
dry-run: ${{ inputs.dry-run-release }}
|
||||
|
||||
publish-git-tag:
|
||||
if: |
|
||||
always() &&
|
||||
(${{ inputs.publish-git-tag == 'true' }} && (needs.unit-tests.result == 'success' || needs.unit-tests.result == 'skipped'))
|
||||
needs: [lint, unit-tests]
|
||||
name: "Publish Git Tag"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@ -92,6 +180,8 @@ jobs:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
- uses: ./.github/actions/setup
|
||||
with:
|
||||
npm_tag: ${{ inputs.npm-tag }}
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/configure-git-author@v8.16.0
|
||||
with:
|
||||
username: ${{ vars.BOT_GITHUB_USERNAME }}
|
||||
@ -105,6 +195,10 @@ jobs:
|
||||
dry-run: ${{ inputs.dry-run-release }}
|
||||
|
||||
publish-libs:
|
||||
if: |
|
||||
always() &&
|
||||
(${{ inputs.publish-to-npm == 'true' }} && (needs.unit-tests.result == 'success' || needs.unit-tests.result == 'skipped'))
|
||||
needs: [lint, unit-tests]
|
||||
name: "Publish libs to NPM and GitHub registry"
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
@ -122,6 +216,8 @@ jobs:
|
||||
cache: 'npm'
|
||||
|
||||
- uses: ./.github/actions/setup
|
||||
with:
|
||||
npm_tag: ${{ inputs.npm-tag }}
|
||||
|
||||
- name: publish
|
||||
uses: ./.github/actions/publish-libs
|
||||
|
Loading…
x
Reference in New Issue
Block a user