Skip to content

Commit

Permalink
Update hotfix release scripts (#2611)
Browse files Browse the repository at this point in the history
  • Loading branch information
varadarajan-tw authored Dec 3, 2024
1 parent bb253f2 commit c4e70e2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 30 deletions.
19 changes: 0 additions & 19 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,3 @@ jobs:
script: |
const script = require('./scripts/github-action/create-github-release.js')
await script({github, context, core, exec})
# When hotfix is merged back to main, we tag all the packages that were changed in the hotfix commit.
tag-hotfix:
if: startsWith(github.event.head_commit.message, 'Hotfix:') == true && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Generate Package Specific Tags
id: get-release-tag
run: ./scripts/generate-package-tags.sh
7 changes: 0 additions & 7 deletions scripts/generate-release-tags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,6 @@ else
fi


# For hotfix, we don't tag each package version and we do it when hotfix changes are merged to main branch.
if [[ $branch == hotfix/* ]];
then
echo "Skipping package tag generation for hotfix branch"
exit 0
fi;

# Generate and push package tags.
curr_path=$(pwd)
dir_name=$(dirname $0)
Expand Down
16 changes: 12 additions & 4 deletions scripts/github-action/create-github-release.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
// This is a github action script and can be run only from github actions. To run this script locally, you need to mock the github object and context object.
module.exports = async ({ github, context, core, exec }) => {
let { GITHUB_SHA, DRY_RUN } = process.env
let { GITHUB_SHA, DRY_RUN, GITHUB_REF } = process.env

// Get the branch name from the GITHUB_REF
const branchName = GITHUB_REF.replace('refs/heads/', '')
const isHotfixBranch = branchName.startsWith('hotfix/')

if (Boolean(DRY_RUN)) {
core.info('Running in dry-run mode')
}

// Get the last two commits that have the word "Publish" in the commit message along with the date
const [newPublish, previousPublish] = await getPreviousTwoPublishCommits(core, exec)
const prs = await getPRsBetweenCommits(github, context, core, previousPublish, newPublish)
let prs = []
// Retrieve PRs merged between the last two publish commits only for normal releases
if (!isHotfixBranch) {
// Get the last two commits that have the word "Publish" in the commit message along with the date
const [newPublish, previousPublish] = await getPreviousTwoPublishCommits(core, exec)
prs = await getPRsBetweenCommits(github, context, core, previousPublish, newPublish)
}

// Get tag for the current release from the git repository
const newReleaseTag = await getReleaseTag(core, exec)
Expand Down

0 comments on commit c4e70e2

Please sign in to comment.