Skip to content

chore(release): merge release/5.0.0 into main #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
8 changes: 0 additions & 8 deletions .eslintignore

This file was deleted.

46 changes: 0 additions & 46 deletions .eslintrc.json

This file was deleted.

22 changes: 22 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,25 @@ updates:
directory: '/'
schedule:
interval: 'weekly'
target-branch: 'develop'

- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'weekly'
target-branch: 'develop'
groups:
npm-prod-deps:
patterns:
- '*'
update-types:
- 'minor'
- 'patch'
dependency-type: 'production'
npm-dev-deps:
patterns:
- '*'
dependency-type: 'development'
update-types:
- 'minor'
- 'patch'
28 changes: 19 additions & 9 deletions .github/workflows/create-hotfix-branch.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
name: Create new hotfix branch
name: Create a new hotfix branch

on:
workflow_dispatch:
inputs:
hotfix_name:
description: Hotfix branch name
hotfix_branch_name:
description: Hotfix branch name ('hotfix/' is automatically prepended)
required: true

jobs:
create-branch:
name: Create new branch
name: Create a new hotfix branch
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Create branch
uses: peterjgrainger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout source code
uses: actions/checkout@v4
with:
branch: 'hotfix/${{ github.event.inputs.hotfix_name }}'
fetch-depth: 0

# 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 user.name "GitHub actions"
git config user.email [email protected]
- name: Create hotfix branch
run: |
chmod +x scripts/create-hotfix-branch.sh
./scripts/create-hotfix-branch.sh "${{ github.event.inputs.hotfix_branch_name }}"
30 changes: 25 additions & 5 deletions .github/workflows/deploy-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,27 @@ jobs:

- name: Send message to Slack channel
id: slack
uses: slackapi/[email protected]
continue-on-error: true
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
PROJECT_NAME: 'Gatsby Plugin'
NPM_PACKAGE_URL: 'https://www.npmjs.com/package/gatsby-plugin-rudderstack'
RELEASES_URL: 'https://github.com/rudderlabs/gatsby-plugin-rudderstack/releases/tag/v'
with:
channel-id: ${{ secrets.SLACK_RELEASE_CHANNEL_ID }}
method: 'chat.postMessage'
token: ${{ secrets.SLACK_BOT_TOKEN }}
retries: rapid
payload-templated: true
payload: |
{
"channel": ${{ secrets.SLACK_RELEASE_CHANNEL_ID }},
"text": "*New Release: ${{ env.PROJECT_NAME }} - <${{ env.NPM_PACKAGE_URL }}|${{ env.CURRENT_VERSION_VALUE }}>*\n${{ env.DATE }}\nCC: <!subteam^S0555JBV36D> <!subteam^S03SHJ20350>",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "New release: ${{ env.PROJECT_NAME }}"
"text": "New Release: ${{ env.PROJECT_NAME }}"
}
},
{
Expand All @@ -75,8 +81,22 @@ jobs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Release: <${{ env.NPM_PACKAGE_URL }}|${{ env.CURRENT_VERSION_VALUE }}>*\n${{ env.DATE }}"
"text": "*<${{ env.NPM_PACKAGE_URL }}|v${{ env.CURRENT_VERSION_VALUE }}>*\n${{ env.DATE }}\nCC: <!subteam^S0555JBV36D> <!subteam^S03SW7DM8P3>"
},
"accessory": {
"type": "image",
"image_url": "https://img.icons8.com/color/452/npm.png",
"alt_text": "NPM Icon"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "For more details, check the full release notes <${{ env.RELEASES_URL }}${{ env.CURRENT_VERSION_VALUE }}|here>."
}
]
}
]
}
34 changes: 27 additions & 7 deletions .github/workflows/draft-new-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,30 @@ jobs:
git push

- name: Create pull request into main
uses: repo-sync/pull-request@v2
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*'
env:
GH_TOKEN: ${{ secrets.PAT }}
run: |
pr_title="chore(release): merge ${{ steps.create-release.outputs.branch_name }} into main"

# Create PR body with proper formatting
cat > pr_body.md << EOF
:crown: **Automated Release PR**

This pull request was created automatically by the GitHub Actions workflow. It merges the release branch (\`${{ steps.create-release.outputs.branch_name }}\`) into the \`main\` branch.

This ensures that the latest release branch changes are incorporated into the \`main\` branch for production.

### Details
- **Release Version**: v${{ env.NEW_VERSION_VALUE }}
- **Release Branch**: \`${{ steps.create-release.outputs.branch_name }}\`

---
Please review and merge when ready. :rocket:
EOF

# Create the PR using GitHub CLI
gh pr create \
--base main \
--head ${{ steps.create-release.outputs.branch_name }} \
--title "$pr_title" \
--body-file pr_body.md
36 changes: 21 additions & 15 deletions .github/workflows/housekeeping.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
name: Handle stale PRs
name: Handle Stale PRs and Branches

on:
schedule:
- cron: '42 1 * * *'
- cron: '1 0 * * *' # every day at 00:01

concurrency:
group: ${{ github.workflow }}-${{ github.sha }}
cancel-in-progress: true

jobs:
prs:
name: Clean up stale prs
name: Clean up stale PRs
runs-on: ubuntu-latest

permissions:
Expand All @@ -16,26 +20,28 @@ jobs:
steps:
- uses: actions/stale@v9
with:
repo-token: ${{ github.token }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
operations-per-run: 200
stale-pr-message: 'This PR is considered to be stale. It has been open 20 days with no further activity thus it is going to be closed in 10 days. To avoid such a case please consider removing the stale label manually or add a comment to the PR.'
stale-pr-message: "Hello! This PR has been open for 20 days without any activity. Therefore, it's considered as stale and is scheduled to be closed in 10 days. If you're still working on this, please remove the 'Stale' label or add a comment to keep it open. Thanks for your contribution!"
days-before-pr-stale: 20
days-before-pr-close: 10
stale-pr-label: 'Stale'
ascending: true

branches:
name: Cleanup old branches
name: Clean up stale branches
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Run delete-old-branches-action
uses: beatlabs/[email protected]
with:
repo_token: ${{ github.token }}
date: '2 months ago'
dry_run: false
delete_tags: false
extra_protected_branch_regex: ^(main|develop)$
exclude_open_pr_branches: true
fetch-depth: 0

- name: Run branch cleanup script
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
chmod +x ./scripts/cleanup-old-branches.sh
./scripts/cleanup-old-branches.sh \
--months 2 \
--protected-branches "^(main|develop)$"
71 changes: 42 additions & 29 deletions .github/workflows/publish-new-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,49 +52,57 @@ jobs:
npx conventional-github-releaser -p angular
echo "DATE=$(date)" >> $GITHUB_ENV
- name: Create pull request into staging
uses: repo-sync/pull-request@v2
with:
source_branch: 'main'
destination_branch: 'develop'
github_token: ${{ secrets.PAT }}
pr_title: 'chore(release): pull main into develop post release v${{ steps.extract-version.outputs.release_version }}'
pr_body: ':crown: *An automated PR*'
pr_reviewer: 'rudderlabs/js-sdk'

- 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/*'
- name: Create pull request into develop
if: always()
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.PAT }}
run: |
pr_title="chore(release): merge main into develop after release v${{ steps.extract-version.outputs.release_version }}"
# Create PR body with proper formatting
cat > pr_body.md << EOF
:crown: **Automated Post-Release 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 }}
This pull request was created automatically by the GitHub Actions workflow. It merges changes from the \`main\` branch into the \`develop\` branch after a release has been completed.
This ensures that the \`develop\` branch stays up to date with all release-related changes from the \`main\` branch.
### Details
- **Release Version**: v${{ steps.extract-version.outputs.release_version }}
---
Please review and merge it before closing the release ticket. :rocket:
EOF
# Create the PR using GitHub CLI
gh pr create \
--base develop \
--head main \
--title "$pr_title" \
--body-file pr_body.md
- name: Send message to Slack channel
id: slack
uses: slackapi/slack-github-action@v1.27.0
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
PROJECT_NAME: 'Gatsby Rudderstack Plugin'
PROJECT_NAME: 'Gatsby Plugin'
RELEASES_URL: 'https://github.com/rudderlabs/gatsby-plugin-rudderstack/releases/'
with:
channel-id: ${{ secrets.SLACK_RELEASE_CHANNEL_ID }}
method: 'chat.postMessage'
token: ${{ secrets.SLACK_BOT_TOKEN }}
retries: rapid
payload-templated: true
payload: |
{
"channel": ${{ secrets.SLACK_RELEASE_CHANNEL_ID }},
"text": "*New Release: ${{ env.PROJECT_NAME }} - <${{env.RELEASES_URL}}${{ steps.extract-version.outputs.release_version }}|v${{ steps.extract-version.outputs.release_version }}>*\n${{ env.DATE }}\nCC: <!subteam^S0555JBV36D> <!subteam^S03SHJ20350>",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "New release: ${{ env.PROJECT_NAME }}"
"text": "New Release: ${{ env.PROJECT_NAME }}"
}
},
{
Expand All @@ -104,7 +112,12 @@ jobs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Release: <${{env.RELEASES_URL}}${{ steps.extract-version.outputs.release_version }}|v${{ steps.extract-version.outputs.release_version }}>*\n${{ env.DATE }}"
"text": "*<${{env.RELEASES_URL}}${{ steps.extract-version.outputs.release_version }}|v${{ steps.extract-version.outputs.release_version }}>*\n${{ env.DATE }}\nCC: <!subteam^S0555JBV36D> <!subteam^S03SHJ20350>"
},
"accessory": {
"type": "image",
"image_url": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png",
"alt_text": "GitHub Icon"
}
}
]
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ jobs:

- name: Fix filesystem paths in generated reports
run: |
sed -i 's+/home/runner/work/gatsby-plugin-rudderstack/gatsby-plugin-rudderstack+/github/workspace+g' reports/eslint.json
sed -i 's+/home/runner/work/gatsby-plugin-rudderstack/gatsby-plugin-rudderstack++g' reports/eslint.json

- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@aa494459d7c39c106cc77b166de8b4250a32bb97 # v5.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Loading