Skip to content

Commit

Permalink
chore: setup CI/CD for v53 legacy branch (#3705)
Browse files Browse the repository at this point in the history
  • Loading branch information
GermainBergeron committed Apr 30, 2024
1 parent 9a6b436 commit 096b300
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 23 deletions.
5 changes: 5 additions & 0 deletions .github/actions/publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ runs:
tag: 'next',
branch: 'next',
});
} else if (context.ref === 'refs/heads/v53') {
await publishNewVersion({github, context, exec}, {
tag: 'v53',
branch: 'v53',
});
} else {
await publishNewVersion({github, context, exec});
}
19 changes: 11 additions & 8 deletions .github/actions/publish/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import getLastTag from './getLastTag.mjs';
const VERSION_PREFIX = 'v';
const PATH = '.';
const BUMP_TYPES = ['major', 'minor', 'patch', 'prerelease'];
const DEFAULT_BRANCH = 'master';

/**
* @param options Optional options to use when publishing
Expand All @@ -30,12 +31,10 @@ const BUMP_TYPES = ['major', 'minor', 'patch', 'prerelease'];
* * `branch: string`: Branch name used to publish the new version (default `"master"`)
* * `bump: BUMP_TYPES`: Force a specific version bump instead of relying on the commit message
*/
export default async ({github, context, exec}, {
dry = false,
tag = 'latest',
branch = 'master',
bump = null
} = {}) => {
export default async (
{github, context, exec},
{dry = false, tag = 'latest', branch = DEFAULT_BRANCH, bump = null} = {},
) => {
const GIT_USERNAME = 'coveobot';
const GIT_EMAIL = '[email protected]';
const GIT_SSH_REMOTE = 'deploy';
Expand Down Expand Up @@ -66,14 +65,18 @@ export default async ({github, context, exec}, {
bumpInfo = convention.recommendedBumpOpts.whatBump(parsedCommits);
}

if (bumpInfo.type === 'major' && branch !== DEFAULT_BRANCH) {
throw new Error(`Cannot bump a major version on a branch other than ${DEFAULT_BRANCH}`);
}

const currentVersion = lastTag.replace(VERSION_PREFIX, '');
const newVersion = getNextVersion(currentVersion, bumpInfo);

if (newVersion !== currentVersion) {
console.info('Bumping %s to version %s', changedPackages.join(', '), newVersion);
await pnpmBumpVersion(newVersion, lastTag, ['root']);

let changelog = ''
let changelog = '';
if (parsedCommits.length > 0) {
changelog = await generateChangelog(
parsedCommits,
Expand All @@ -82,7 +85,7 @@ export default async ({github, context, exec}, {
...context.repo,
host: 'https://github.com',
},
convention.writerOpts
convention.writerOpts,
);
await writeChangelog(PATH, changelog);
}
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ concurrency:
jobs:
cd:
name: Continuous Delivery
if: github.ref_name == 'master' || github.ref_name == 'next'
if: github.ref_name == 'master' || github.ref_name == 'next' || github.ref_name == 'v53'
runs-on: ubuntu-latest
environment: production
permissions:
Expand Down Expand Up @@ -42,8 +42,6 @@ jobs:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Deploy
uses: ./.github/actions/deploy
# Demo for next branch is deployed by the CI workflow
if: github.ref != 'refs/heads/next'
with:
AWS_ROLE: ${{ secrets.AWS_ROLE }}
AWS_REGION: ${{ secrets.AWS_REGION }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ name: 'CodeQL'

on:
push:
branches: ['master', next]
branches: ['master', 'next', 'v53']
pull_request:
# The branches below must be a subset of the branches above
branches: ['master']
branches: ['master', 'next', 'v53']
schedule:
- cron: '17 2 * * 1'

Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
name: 'Dependency Review'

on:
pull_request:
branches: [ "master", next ]
pull_request:
branches: ['master', 'next', 'v53']

permissions:
contents: read
pull-requests: write
contents: read
pull-requests: write

jobs:
dependency-Review:
name: Review
uses: coveo/public-actions/.github/workflows/dependency-review.yml@main
with:
public: true
distributed: true
dependency-Review:
name: Review
uses: coveo/public-actions/.github/workflows/dependency-review.yml@main
with:
public: true
distributed: true

0 comments on commit 096b300

Please sign in to comment.