Skip to content

Commit

Permalink
ci: setup CI/CD pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
soumyamahunt committed Mar 9, 2022
1 parent 269cb54 commit 3e20bc9
Show file tree
Hide file tree
Showing 5 changed files with 418 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/config/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict'
const config = require('conventional-changelog-conventionalcommits');

module.exports = config({
"types": [
{ type: 'feat', section: '🚀 Features' },
{ type: 'fix', section: '🐛 Fixes' },
{ type: 'perf', section: '🐎 Performance Improvements' },
{ type: 'revert', section: '⏪ Reverts' },
{ type: 'build', section: '🛠 Build System' },
{ type: 'ci', section: '💡 Continuous Integration' },
{ type: 'refactor', section: '🔥 Refactorings' },
{ type: 'doc', section: '📚 Documentation' },
{ type: 'docs', section: '📚 Documentation' },
{ type: 'style', section: '💄 Styles' },
{ type: 'test', section: '✅ Tests' },
{ type: 'wip', hidden: true },
{ type: 'chore', hidden: true },
]
})
223 changes: 223 additions & 0 deletions .github/config/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions .github/config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "config",
"version": "1.0.0",
"description": "conventional-changelog-action hooks",
"main": "config.js",
"license": "MIT",
"author": {
"name": "Soumya Ranjan Mahunt",
"email": "devsoumyamahunt@gmail.com"
},
"dependencies": {
"@actions/core": "1.6.0",
"conventional-changelog-conventionalcommits": "^4.6.3",
"semver": "^7.3.5"
}
}
30 changes: 30 additions & 0 deletions .github/config/pre_changelog_hook.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const path = require('path');
const fs = require('fs');
const semver = require('semver');
const core = require('@actions/core');
const childProcess = require("child_process");

exports.preVersionGeneration = (version) => {
const { GITHUB_WORKSPACE } = process.env;
core.info(`Computed version bump: ${version}`);

const gem_info_file = path.join(GITHUB_WORKSPACE, 'lib/cocoapods-embed-flutter/gem_version.rb');
const gem_info = `${fs.readFileSync(gem_info_file)}`;
core.info(`Current gem info: ${gem_info}`);

currentVersion = gem_info.match(/VERSION\s*=\s'(.*)'/)[1];
core.info(`Current version: ${currentVersion}`);

if (semver.lt(version, currentVersion)) { version = currentVersion; }
core.info(`Final version: ${version}`);

const new_gem_info = gem_info.replace(/VERSION\s*=\s*.*/g, `VERSION = '${version}'.freeze`);
core.info(`Updated gem info: ${new_gem_info}`);
fs.writeFileSync(gem_info_file, new_gem_info);

const launchOption = { cwd: GITHUB_WORKSPACE };
childProcess.execSync('bundle exec rake demo', launchOption);
return version;
}

exports.preTagGeneration = (tag) => { }
Loading

0 comments on commit 3e20bc9

Please sign in to comment.