From b2a21addc31fc87269bed8dbca1eec27b1ea1208 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 7 Jun 2023 17:18:59 +0100 Subject: [PATCH] Updating release workflows to use a script instead of repeating and adding scripts for updating and resetting dependencies if attempting to build packages locally. --- .github/workflows/release-develop.yml | 13 +----------- .github/workflows/release-master.yml | 13 +----------- .github/workflows/release-singleimage.yml | 26 ++--------------------- packages/worker/package.json | 2 +- scripts/resetVersions.sh | 7 ++++++ scripts/updateVersions.sh | 12 +++++++++++ 6 files changed, 24 insertions(+), 49 deletions(-) create mode 100755 scripts/resetVersions.sh create mode 100755 scripts/updateVersions.sh diff --git a/.github/workflows/release-develop.yml b/.github/workflows/release-develop.yml index 9bb37d7356..a7bf041eb5 100644 --- a/.github/workflows/release-develop.yml +++ b/.github/workflows/release-develop.yml @@ -48,18 +48,7 @@ jobs: - run: yarn install --frozen-lockfile - name: Update versions - run: | - version=$(cat lerna.json \ - | grep version \ - | head -1 \ - | awk -F: '{gsub(/"/,"",$2);gsub(/[[:space:]]*/,"",$2); print $2}' \ - | sed 's/[",]//g') - echo "Setting version $version" - yarn lerna exec "yarn version --no-git-tag-version --new-version=$version" - echo "Updating dependencies" - node scripts/syncLocalDependencies.js $version - echo "Syncing yarn workspace" - yarn + run: ./scripts/updateVersions.sh - run: yarn build - run: yarn build:sdk diff --git a/.github/workflows/release-master.yml b/.github/workflows/release-master.yml index a105d8a712..68625ad7af 100644 --- a/.github/workflows/release-master.yml +++ b/.github/workflows/release-master.yml @@ -41,18 +41,7 @@ jobs: - run: yarn install --frozen-lockfile - name: Update versions - run: | - version=$(cat lerna.json \ - | grep version \ - | head -1 \ - | awk -F: '{gsub(/"/,"",$2);gsub(/[[:space:]]*/,"",$2); print $2}' \ - | sed 's/[",]//g') - echo "Setting version $version" - yarn lerna exec "yarn version --no-git-tag-version --new-version=$version" - echo "Updating dependencies" - node scripts/syncLocalDependencies.js $version - echo "Syncing yarn workspace" - yarn + run: ./scripts/updateVersions.sh - run: yarn lint - run: yarn build - run: yarn build:sdk diff --git a/.github/workflows/release-singleimage.yml b/.github/workflows/release-singleimage.yml index eadf40ca00..5408b48ef8 100644 --- a/.github/workflows/release-singleimage.yml +++ b/.github/workflows/release-singleimage.yml @@ -47,33 +47,11 @@ jobs: - name: Run Yarn run: yarn - name: Update versions - run: | - version=$(cat lerna.json \ - | grep version \ - | head -1 \ - | awk -F: '{gsub(/"/,"",$2);gsub(/[[:space:]]*/,"",$2); print $2}' \ - | sed 's/[",]//g') - echo "Setting version $version" - yarn lerna exec "yarn version --no-git-tag-version --new-version=$version" - echo "Updating dependencies" - node scripts/syncLocalDependencies.js $version - echo "Syncing yarn workspace" - yarn + run: ./scripts/updateVersions.sh - name: Runt Yarn Lint run: yarn lint - name: Update versions - run: | - version=$(cat lerna.json \ - | grep version \ - | head -1 \ - | awk -F: '{gsub(/"/,"",$2);gsub(/[[:space:]]*/,"",$2); print $2}' \ - | sed 's/[",]//g') - echo "Setting version $version" - yarn lerna exec "yarn version --no-git-tag-version --new-version=$version" - echo "Updating dependencies" - node scripts/syncLocalDependencies.js $version - echo "Syncing yarn workspace" - yarn + run: ./scripts/updateVersions.sh - name: Run Yarn Build run: yarn build:docker:pre - name: Login to Docker Hub diff --git a/packages/worker/package.json b/packages/worker/package.json index f07cb011a0..b11512f88f 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -104,4 +104,4 @@ "update-dotenv": "1.1.1" }, "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc" -} \ No newline at end of file +} diff --git a/scripts/resetVersions.sh b/scripts/resetVersions.sh new file mode 100755 index 0000000000..83411f5153 --- /dev/null +++ b/scripts/resetVersions.sh @@ -0,0 +1,7 @@ +#!/bin/bash +echo "Resetting package versions" +yarn lerna exec "yarn version --no-git-tag-version --new-version=0.0.0" +echo "Updating dependencies" +node scripts/syncLocalDependencies.js "0.0.0" +git checkout package.json +echo "Package versions reset!" diff --git a/scripts/updateVersions.sh b/scripts/updateVersions.sh new file mode 100755 index 0000000000..51ad70366c --- /dev/null +++ b/scripts/updateVersions.sh @@ -0,0 +1,12 @@ +#!/bin/bash +version=$(cat lerna.json \ + | grep version \ + | head -1 \ + | awk -F: '{gsub(/"/,"",$2);gsub(/[[:space:]]*/,"",$2); print $2}' \ + | sed 's/[",]//g') +echo "Setting version $version" +yarn lerna exec "yarn version --no-git-tag-version --new-version=$version" +echo "Updating dependencies" +node scripts/syncLocalDependencies.js $version +echo "Syncing yarn workspace" +yarn