-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from rudderlabs/develop
- Loading branch information
Showing
5 changed files
with
242 additions
and
97 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Create New Hotfix Branch | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
hotfix_name: | ||
description: Hotfix branch name | ||
required: true | ||
|
||
jobs: | ||
create-branch: | ||
name: Create New Hotfix Branch | ||
runs-on: ubuntu-latest | ||
|
||
# Only allow these users to create new hotfix branch from 'main' | ||
if: github.ref == 'refs/heads/main' && (github.actor == 'ItsSudip' || github.actor == 'krishna2020' || github.actor == 'utsabc' || github.actor == 'shrouti1507') && (github.triggering_actor == 'ItsSudip' || github.triggering_actor == 'krishna2020' || github.triggering_actor == 'shrouti1507' || github.triggering_actor == 'utsabc') | ||
steps: | ||
- name: Create Branch | ||
uses: peterjgrainger/action-create-branch@v2.4.0 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PAT }} | ||
with: | ||
branch: 'hotfix/${{ inputs.hotfix_name }}' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
name: Draft New Release | ||
|
||
on: workflow_dispatch | ||
|
||
jobs: | ||
draft-new-release: | ||
name: Draft New Release | ||
runs-on: ubuntu-latest | ||
|
||
# Only allow release stakeholders to initiate releases | ||
if: (github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/hotfix/')) && (github.actor == 'ItsSudip' || github.actor == 'krishna2020' || github.actor == 'utsabc' || github.actor == 'shrouti1507') && (github.triggering_actor == 'ItsSudip' || github.triggering_actor == 'krishna2020' || github.triggering_actor == 'utsabc' || github.triggering_actor == 'shrouti1507') | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4.1.0 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v4.0.1 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: 'npm' | ||
|
||
- name: Install Dependencies | ||
env: | ||
HUSKY: 0 | ||
run: | | ||
npm ci | ||
# In order to make a commit, we need to initialize a user. | ||
# You may choose to write something less generic here if you want, it doesn't matter functionality wise. | ||
- name: Initialize Mandatory Git Config | ||
run: | | ||
git config --global user.name "GitHub Actions" | ||
git config --global user.email "noreply@github.com" | ||
# Calculate the next release version based on conventional semantic release | ||
- name: Create Release Branch | ||
id: create-release | ||
env: | ||
HUSKY: 0 | ||
run: | | ||
source_branch_name=${GITHUB_REF##*/} | ||
release_type=release | ||
grep -q "hotfix/" <<< "${GITHUB_REF}" && release_type=hotfix-release | ||
git fetch origin main | ||
git fetch --tags origin | ||
git merge origin/main | ||
current_version=$(jq -r .version package.json) | ||
npm run release -- --skip.commit --skip.tag --skip.changelog | ||
new_version=$(jq -r .version package.json) | ||
git reset --hard | ||
branch_name="${release_type}/v${new_version}" | ||
echo "Source branch for new release is $source_branch_name" | ||
echo "Current version is $current_version" | ||
echo "Release type is $release_type" | ||
echo "New version is $new_version" | ||
echo "New release branch name is $branch_name" | ||
git checkout -b "$branch_name" | ||
git push --set-upstream origin "$branch_name" | ||
echo "source_branch_name=$source_branch_name" >> $GITHUB_OUTPUT | ||
echo "branch_name=$branch_name" >> $GITHUB_OUTPUT | ||
echo "new_version=$new_version" >> $GITHUB_OUTPUT | ||
echo "CURRENT_VERSION_VALUE=$current_version" >> $GITHUB_ENV | ||
echo "NEW_VERSION_VALUE=$new_version" >> $GITHUB_ENV | ||
- name: Update Changelog & Bump Version | ||
id: finish-release | ||
env: | ||
HUSKY: 0 | ||
run: | | ||
echo "Current version: $CURRENT_VERSION_VALUE" | ||
echo "New version: $NEW_VERSION_VALUE" | ||
npm run release -- -a --skip.tag --no-verify | ||
git push | ||
- name: Create Pull Request | ||
uses: repo-sync/pull-request@v2.12.1 | ||
with: | ||
source_branch: ${{ steps.create-release.outputs.branch_name }} | ||
destination_branch: 'main' | ||
github_token: ${{ secrets.PAT }} | ||
pr_title: 'chore(release): pull ${{ steps.create-release.outputs.branch_name }} into main' | ||
pr_body: ':crown: *An automated PR*' |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
name: Publish New GitHub Release | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
branches: | ||
- main | ||
|
||
jobs: | ||
release: | ||
name: Publish New GitHub Release | ||
runs-on: ubuntu-latest | ||
|
||
if: (startsWith(github.event.pull_request.head.ref, 'release/') || startsWith(github.event.pull_request.head.ref, 'hotfix-release/')) && github.event.pull_request.merged == true # only merged pull requests must trigger this job | ||
|
||
steps: | ||
- name: Extract Version | ||
id: extract-version | ||
run: | | ||
branch_name="${{ github.event.pull_request.head.ref }}" | ||
version=${branch_name#hotfix-} | ||
version=${version#release/v} | ||
echo "release_version=$version" >> $GITHUB_OUTPUT | ||
- name: Checkout | ||
uses: actions/checkout@v4.1.0 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v4.0.1 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: 'npm' | ||
|
||
- name: Install Dependencies | ||
env: | ||
HUSKY: 0 | ||
run: | | ||
npm ci | ||
# In order to make a commit, we need to initialize a user. | ||
# You may choose to write something less generic here if you want, it doesn't matter functionality wise. | ||
- name: Initialize Mandatory Git Config | ||
run: | | ||
git config --global user.name "GitHub Actions" | ||
git config --global user.email "noreply@github.com" | ||
- name: Tag & Create GitHub Release | ||
id: create_release | ||
env: | ||
HUSKY: 0 | ||
GITHUB_TOKEN: ${{ secrets.PAT }} | ||
CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{ secrets.PAT }} | ||
run: | | ||
git fetch --tags origin | ||
git tag -a v${{ steps.extract-version.outputs.release_version }} -m "chore: release v${{ steps.extract-version.outputs.release_version }}" | ||
git push origin refs/tags/v${{ steps.extract-version.outputs.release_version }} | ||
npm run release:github | ||
echo "DATE=$(date)" >> $GITHUB_ENV | ||
- name: Pull Changes Into develop Branch | ||
uses: repo-sync/pull-request@v2.12.1 | ||
with: | ||
source_branch: 'main' | ||
destination_branch: 'develop' | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
pr_title: 'chore(release): pull main into develop post release v${{ steps.extract-version.outputs.release_version }}' | ||
pr_body: ':crown: *An automated PR*' | ||
|
||
- name: Delete Release Branch | ||
uses: koj-co/delete-merged-action@master | ||
if: startsWith(github.event.pull_request.head.ref, 'release/') | ||
with: | ||
branches: 'release/*' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Delete Hotfix Release Branch | ||
uses: koj-co/delete-merged-action@master | ||
if: startsWith(github.event.pull_request.head.ref, 'hotfix-release/') | ||
with: | ||
branches: 'hotfix-release/*' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Notify Slack Channel | ||
id: slack | ||
uses: slackapi/slack-github-action@v1.24.0 | ||
continue-on-error: true | ||
env: | ||
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | ||
PROJECT_NAME: 'Rudder Shopify Tracker' | ||
RELEASES_URL: 'https://github.com/rudderlabs/rudder-shopify-tracker/releases/tag/' | ||
with: | ||
channel-id: ${{ secrets.SLACK_RELEASE_CHANNEL_ID }} | ||
payload: | | ||
{ | ||
"text": "*<${{env.RELEASES_URL}}v${{ steps.extract-version.outputs.release_version }}|v${{ steps.extract-version.outputs.release_version }}>*\nCC: <@U03KG4BK1L1> <@U01LVJ30QEB> <@U01FG952S8Y>", | ||
"blocks": [ | ||
{ | ||
"type": "header", | ||
"text": { | ||
"type": "plain_text", | ||
"text": ":tada: ${{ env.PROJECT_NAME }} - New GitHub Release :tada:" | ||
} | ||
}, | ||
{ | ||
"type": "divider" | ||
}, | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": "*<${{env.RELEASES_URL}}v${{ steps.extract-version.outputs.release_version }}|v${{ steps.extract-version.outputs.release_version }}>*\nCC: <@U03KG4BK1L1> <@U01LVJ30QEB> <@U01FG952S8Y>" | ||
} | ||
} | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.