changes #17
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=2208.12.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" | |
- 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: Create Pull Request | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
branch: "${{ env.RELEASE_BRANCH }}" | |
delete-branch: true | |
title: "Release ${{ github.event.inputs.version }}" | |
body: "Automated pull request to merge the release branch into develop." | |
base: "develop" | |
token: ${{ secrets.GITHUB_TOKEN }} |