default ver #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Minor Release Workflow | |
on: | |
push: | |
branches: | |
- steps-for-rls-worklfow | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Release version (e.g., 2211.20.0 or 2211.20.0-1)' | |
required: false | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: develop | |
- name: Configure Git | |
run: | | |
git config user.name 'github-actions[bot]' | |
git config user.email 'github-actions[bot]@users.noreply.github.com' | |
- name: Set Default Version | |
run: | | |
if [ -z "${{ github.event.inputs.version }}" ]; then | |
echo "No version provided, setting default version." | |
echo "version=2209.10.0" >> $GITHUB_ENV | |
else | |
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_ENV | |
fi | |
- name: Create Release Branch | |
run: | | |
version="${{ env.version }}" | |
if [[ $version == *-* ]]; then | |
IFS='-' read -ra VERSION_AND_PRERELEASE <<< "$version" | |
prerelease="${VERSION_AND_PRERELEASE[*]:1}" | |
version_part=${VERSION_AND_PRERELEASE[0]} | |
else | |
version_part=$version | |
prerelease="" | |
fi | |
IFS='.' read -ra ADDR <<< "$version_part" | |
echo "major=${ADDR[0]}" >> $GITHUB_ENV | |
echo "minor=${ADDR[1]}" >> $GITHUB_ENV | |
echo "patch=${ADDR[2]}" >> $GITHUB_ENV | |
release_branch="release-${ADDR[0]}.${ADDR[1]}.${ADDR[2]}" | |
if [[ -n $prerelease ]]; then | |
release_branch="${release_branch}-${prerelease// /-}" | |
fi | |
echo "RELEASE_BRANCH=$release_branch" >> $GITHUB_ENV | |
echo "Checking for existence of the branch: $release_branch" | |
if git ls-remote --heads origin "$release_branch" | grep -q "$release_branch"; then | |
echo "Error: Branch $release_branch already exists. Please check the branch before proceeding." | |
exit 1 | |
else | |
echo "Branch $release_branch does not exist. Creating new one." | |
git checkout -b "$release_branch" | |
- name: Update SCSS Versioning | |
run: | | |
major=${{ env.major }} | |
minor=${{ env.minor }} | |
patch=${{ env.patch }} | |
sed -i "s/major: [0-9]\\{1,\\},/major: $major,/" projects/storefrontstyles/scss/_versioning.scss | |
sed -i "s/minor: [0-9]\\{1,\\},/minor: $minor,/" projects/storefrontstyles/scss/_versioning.scss | |
sed -i "s/patch: [0-9]\\{1,\\},/patch: $patch,/" projects/storefrontstyles/scss/_versioning.scss | |
echo "Updated versions in projects/storefrontstyles/scss/_versioning.scss." | |
- name: Update Publishing Version | |
run: | | |
version="${{ env.major }}.${{ env.minor }}.${{ env.patch }}" | |
sed -i "s/export const PUBLISHING_VERSION = '.*';/export const PUBLISHING_VERSION = '$version';/" ./tools/config/const.ts | |
echo "Updated PUBLISHING_VERSION in ./tools/config/const.ts." | |
- name: Run NPM Commands | |
run: | | |
if ! npm run config:update; then | |
echo "Error: The configuration file is not up to date. Regenerating dependencies..." | |
npm run generate:deps | |
npm run config:update | |
fi | |
npm run generate:deps | |
npm run test:all-schematics | |
- name: Push Changes | |
run: | | |
git add . | |
git commit -m "Release ${{ env.RELEASE_BRANCH }}" | |
git push origin HEAD:"$release_branch" | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
branch: "${{ env.RELEASE_BRANCH }}" | |
delete-branch: true | |
title: "Release ${{ env.version }}" | |
body: "Automated pull request to merge the release branch into develop." | |
base: "develop" | |
token: ${{ secrets.GITHUB_TOKEN }} |