Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ACS-7241] Support parallel releases #4297

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/get-image-tag/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,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 }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/git-tag/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,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}"

Expand Down
40 changes: 25 additions & 15 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: "Variables setup"
description: "Variables setup"

inputs:
npm_tag:
description: 'NPM tag'
required: false
type: string

runs:
using: "composite"
steps:
Expand All @@ -17,23 +23,27 @@ runs:
- name: set TAG_NPM
shell: bash
run: |
TAG_NPM="alpha"
VERSION_IN_PACKAGE_JSON=$(jq -cr '.version' < package.json)
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}"
echo "version in package.json=${VERSION_IN_PACKAGE_JSON}"

if [[ $BRANCH_NAME =~ ^master(-patch.*)?$ ]]; then
# Pre-release versions
if [[ $VERSION_IN_PACKAGE_JSON =~ ^[0-9]*\.[0-9]*\.[0-9]*-A\.[0-9]*$ ]];
then
TAG_NPM=next
# Stable major versions
else
TAG_NPM=latest
fi
fi
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
TAG_NPM=next
# Stable major versions
else
TAG_NPM=latest
fi
fi

if [[ $BRANCH_NAME =~ ^develop(-patch.*)?$ ]]; then
TAG_NPM=alpha
if [[ $BRANCH_NAME =~ ^develop(-patch.*)?$ ]]; then
TAG_NPM=alpha
fi
fi
echo "TAG_NPM=${TAG_NPM}" >> $GITHUB_ENV
87 changes: 0 additions & 87 deletions .github/workflows/release-branch.yml

This file was deleted.

103 changes: 100 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,44 @@
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
push:
branches:
- master
- develop
- release/**

env:
BASE_URL: ${{ secrets.PIPELINE_ENV_URL }}
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -91,8 +179,11 @@ jobs:
with:
node-version-file: '.nvmrc'
cache: 'npm'
- uses: ./.github/actions/setup
- uses: Alfresco/alfresco-build-tools/.github/actions/[email protected]
- uses: ./.github/actions/setup
with:
npm_tag: ${{ inputs.npm-tag }}
- uses: Alfresco/alfresco-build-tools/.github/actions/[email protected]
with:
username: ${{ vars.BOT_GITHUB_USERNAME }}
email: ${{ vars.BOT_GITHUB_EMAIL }}
Expand All @@ -105,6 +196,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:
Expand All @@ -122,6 +217,8 @@ jobs:
cache: 'npm'

- uses: ./.github/actions/setup
with:
npm_tag: ${{ inputs.npm-tag }}

- name: publish
uses: ./.github/actions/publish-libs
Expand Down
Loading