[{"data":1,"prerenderedAt":810},["ShallowReactive",2],{"\u002Fblog\u002F2020\u002Freleasing-software-is-hard":3,"\u002Fblog\u002F2020\u002Freleasing-software-is-hard-surround":799},{"id":4,"title":5,"author":6,"badge":11,"body":13,"date":777,"description":778,"draft":779,"extension":780,"image":781,"meta":783,"navigation":492,"path":795,"seo":796,"stem":797,"__hash__":798},"posts\u002Fblog\u002F2020\u002Freleasing-software-is-hard.md","Releasing Software Is Hard! Is it?",{"name":7,"to":8,"avatar":9},"Nir Galon","https:\u002F\u002Fx.com\u002Fnirgn975",{"src":10},"\u002Favatar.webp",{"label":12},"tutorials",{"type":14,"value":15,"toc":769},"minimark",[16,20,23,34,39,48,51,60,96,106,110,120,137,150,157,170,173,177,186,199,206,232,236,253,318,321,328,338,372,386,398,405,409,416,423,446,468,652,655,689,696,703,714,721,728,735,739,757,765],[17,18,19],"p",{},"One of the things I always got frustrated with is software releases and versioning.",[17,21,22],{},"In the old days, back when I started to work at my first job as a software engineer my team leader handled all of the project management. It means he knew what issue you're working on at the moment, and when (in what version of the software) it should be merged and be released. To this day I think the versioning was just a random thing there - doesn't mean anything except for all of us to be on the same page when we talked about it or reference it.",[17,24,25,26,33],{},"Bugs and features were pushed forward to next versions without any real systematic reasoning about it, and I knew something about it was off. That's when I opened up my browser and just started googling about the topic. I searched and read a lot, and finally I ran into ",[27,28,32],"a",{"href":29,"rel":30},"https:\u002F\u002Fsemver.org",[31],"nofollow","Semantic Versioning",".",[35,36,38],"h2",{"id":37},"_1-semantic-versioning","1. Semantic Versioning",[17,40,41,42,47],{},"Semantic Versioning (or ",[27,43,46],{"href":44,"rel":45},"https:\u002F\u002Fgithub.com\u002Fsemver\u002Fsemver",[31],"semver",") is basically a simple set of rules and requirements that dictate how version numbers are assigned and incremented. In practice SemVer is probably similar to what you're already doing right now, but similar is worthless. Because without compliance to some sort of formal specification, version numbers are essentially useless for dependency management.",[17,49,50],{},"Semantic Versioning was authored back in 2011 and it's already widely used by the open source community. All the major open source projects embraced it, so it's at least worth reading the specification. Once you follow the semver specification your version numbers and the way they change convey meaning about the underlying code and what has been modified from one version to the next.",[17,52,53,54,59],{},"If that's not convincing you maybe the fact that the Semantic Versioning specification was originally authored by ",[27,55,58],{"href":56,"rel":57},"https:\u002F\u002Fgithub.com\u002Fmojombo",[31],"Tom Preston-Werner"," (cofounder of GitHub) will.",[17,61,62,63,67,68,71,72,75,76,80,81,75,84,87,88,91,92,95],{},"So, if you're still reading this post I assume you're somewhat interested in semver. So go read the specification, it's short, concise, and translated to a lot of languages. I'll just mention the basics: A version format is ",[64,65,66],"code",{},"X.Y.Z"," (",[64,69,70],{},"Major.Minor.Patch"," respectively). The ",[64,73,74],{},"Major"," is incremented if the API additions\u002Fchanges are ",[77,78,79],"strong",{},"backwards incompatible"," (i.e. breaking changes). The ",[64,82,83],{},"Minor",[77,85,86],{},"backwards compatible",". And the ",[64,89,90],{},"Patch"," is incremented if a bug fix ",[77,93,94],{},"not affecting"," the API at all.",[17,97,98],{},[99,100],"img",{"alt":101,"className":102,"src":105},"Semantic Versioning Summary",[103,104],"rounded-lg","mx-auto","\u002Fposts\u002F2020\u002Freleasing-software-is-hard\u002Fsemver-summary.webp",[35,107,109],{"id":108},"_2-sounds-great-but","2. Sounds Great, but..",[17,111,112,113,116,117,119],{},"Semantic Versioning sounds great, but it presents a new problem. Every release someone has to sit down, read the issues\u002Fpull requests and write a ",[64,114,115],{},"changelog"," for that version, from that ",[64,118,115],{}," he should bump the version of the software accordingly. This sounds like a really tedious manual job. This alone kept me from really using SemVer for a long time.",[17,121,122,123,128,129,131,132,136],{},"Until I found ",[27,124,127],{"href":125,"rel":126},"https:\u002F\u002Fgithub.com\u002Fsemantic-release\u002Fsemantic-release",[31],"semantic-release","! Which is a tool to automate the whole package release workflow (determining the next version number, generating the release notes - ",[64,130,115],{},", and publishing the package). This removes the immediate connection between human emotions and version numbers, strictly following the ",[27,133,32],{"href":134,"rel":135},"http:\u002F\u002Fsemver.org",[31]," specification.",[17,138,139,140,145,146,149],{},"To make our life even simpler we can use the ",[27,141,144],{"href":142,"rel":143},"https:\u002F\u002Fgithub.com\u002Fmarketplace\u002Factions\u002Frelease-me#create-a-release",[31],"Release me!"," GitHub action which uses ",[27,147,127],{"href":125,"rel":148},[31]," under the hood.",[17,151,152],{},[99,153],{"alt":154,"className":155,"src":156},"Automate All The Things",[103,104],"\u002Fposts\u002F2020\u002Freleasing-software-is-hard\u002Fautomate-all-the-things.webp",[17,158,159,160,165,166,169],{},"But how semantic-release knows what part of the version it should bump? It uses the commit messages to determine the type of changes in the codebase. So that means we need to adhere to a specific commit message format. By default the semantic-release follows the ",[27,161,164],{"href":162,"rel":163},"https:\u002F\u002Fgithub.com\u002Fangular\u002Fangular.js\u002Fblob\u002Fmaster\u002FDEVELOPERS.md#-git-commit-guidelines",[31],"Angular Commit Message Conventions",", but you can change it with a ",[64,167,168],{},"config"," file. We'll not change it for this post because this format is widely used by the open source community.",[17,171,172],{},"I'm starting to get a feeling here we're just kicking the ball to different places and don't really have a solution to the problem. Because now we need to learn and manually write our commit messages in a specific format.",[35,174,176],{"id":175},"_3-lets-solve-this-once-and-for-all","3. Let's solve this once and for all",[17,178,179,180,185],{},"You're sort of right. Our problem is still present, but those other problems were still present before we talked about them, we just didn't mention them. But fear not, ",[27,181,184],{"href":182,"rel":183},"https:\u002F\u002Fwww.conventionalcommits.org",[31],"Conventional Commits"," to the rescue. The Conventional Commits specification is a convention on top of commit messages that provides a set of rules for creating an explicit commit history. And I know what you're thinking to yourself right now \"another specification?!\".",[17,187,188,189,194,195,198],{},"Again, fear not my young padawan. ",[27,190,193],{"href":191,"rel":192},"https:\u002F\u002Fgithub.com\u002Fcommitizen\u002Fcz-cli",[31],"commitizen"," - a command line utility will help us ",[64,196,197],{},"commit"," and will guide us through every commit.",[17,200,201],{},[99,202],{"alt":203,"className":204,"src":205},"Commitizen In Action",[103,104],"\u002Fposts\u002F2020\u002Freleasing-software-is-hard\u002Fcommitizen-in-action.webp",[17,207,208,209,212,213,215,216,219,220,223,224,227,228,231],{},"So, let's recap all the tools so far. If we use ",[27,210,193],{"href":191,"rel":211},[31]," for ",[64,214,197],{},"s, our commit messages will be in a format compatible with ",[27,217,164],{"href":162,"rel":218},[31]," and ",[27,221,184],{"href":182,"rel":222},[31],". If our commits are compatible with those formats ",[27,225,127],{"href":125,"rel":226},[31]," will determine the next version number, generate the release notes, and publish the package by the ",[27,229,32],{"href":29,"rel":230},[31]," specification. Perfect!",[35,233,235],{"id":234},"_4-time-to-get-our-hands-dirty","4. Time to get our hands dirty",[17,237,238,239,242,243,246,247,252],{},"Let's start by creating a simple ",[64,240,241],{},"package.json"," file with npm in our project directory (let's call it ",[64,244,245],{},"deweb"," because that's what the ",[27,248,251],{"href":249,"rel":250},"https:\u002F\u002Fnamelix.com",[31],"namelix"," generator generated for us).",[254,255,261],"pre",{"className":256,"code":257,"filename":258,"language":259,"meta":260,"style":260},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","mkdir deweb\ncd deweb\ngit init\nnpm init\necho node_modules >> .gitignore\n","terminal","bash","",[64,262,263,276,285,294,302],{"__ignoreMap":260},[264,265,268,272],"span",{"class":266,"line":267},"line",1,[264,269,271],{"class":270},"sBMFI","mkdir",[264,273,275],{"class":274},"sfazB"," deweb\n",[264,277,279,283],{"class":266,"line":278},2,[264,280,282],{"class":281},"s2Zo4","cd",[264,284,275],{"class":274},[264,286,288,291],{"class":266,"line":287},3,[264,289,290],{"class":270},"git",[264,292,293],{"class":274}," init\n",[264,295,297,300],{"class":266,"line":296},4,[264,298,299],{"class":270},"npm",[264,301,293],{"class":274},[264,303,305,308,311,315],{"class":266,"line":304},5,[264,306,307],{"class":281},"echo",[264,309,310],{"class":274}," node_modules",[264,312,314],{"class":313},"sMK4o"," >>",[264,316,317],{"class":274}," .gitignore\n",[17,319,320],{},"Here are my configurations.",[17,322,323],{},[99,324],{"alt":325,"className":326,"src":327},"Init The Project",[103,104],"\u002Fposts\u002F2020\u002Freleasing-software-is-hard\u002Finit-the-project.webp",[17,329,330,331,334,335],{},"Now we need to install ",[27,332,193],{"href":191,"rel":333},[31]," and make our repo ",[77,336,337],{},"commitizen friendly",[254,339,341],{"className":256,"code":340,"filename":258,"language":259,"meta":260,"style":260},"npm install commitizen -g\ncommitizen init cz-conventional-changelog --save-dev --save-exact\n",[64,342,343,356],{"__ignoreMap":260},[264,344,345,347,350,353],{"class":266,"line":267},[264,346,299],{"class":270},[264,348,349],{"class":274}," install",[264,351,352],{"class":274}," commitizen",[264,354,355],{"class":274}," -g\n",[264,357,358,360,363,366,369],{"class":266,"line":278},[264,359,193],{"class":270},[264,361,362],{"class":274}," init",[264,364,365],{"class":274}," cz-conventional-changelog",[264,367,368],{"class":274}," --save-dev",[264,370,371],{"class":274}," --save-exact\n",[17,373,374,375,378,379,382,383,385],{},"This just tells commitizen which adapter we actually want our contributors to use when they try to commit to this repo. And now you can use ",[64,376,377],{},"git cz"," command instead of ",[64,380,381],{},"git commit"," and the commitizen prompt will guide you through the commit message and ",[64,384,197],{}," all the files.",[254,387,389],{"className":256,"code":388,"filename":258,"language":259,"meta":260,"style":260},"git cz\n",[64,390,391],{"__ignoreMap":260},[264,392,393,395],{"class":266,"line":267},[264,394,290],{"class":270},[264,396,397],{"class":274}," cz\n",[17,399,400],{},[99,401],{"alt":402,"className":403,"src":404},"Commit With Commitizen",[103,104],"\u002Fposts\u002F2020\u002Freleasing-software-is-hard\u002Fcommit-with-commitizen.webp",[35,406,408],{"id":407},"_5-release-the-damn-thing","5. Release the damn thing",[17,410,411,412,415],{},"Now, we can use ",[27,413,127],{"href":125,"rel":414},[31]," manually to automatically generate the release (I mean to write the command by hand every time we want to create a new release). But we can do it even better! Why not do it automagically in GitHub actions, and even tie it up to GitHub milestones.",[17,417,418,419,422],{},"So, let's create a GitHub action that uses the ",[27,420,144],{"href":142,"rel":421},[31]," action and runs every time there is a milestone event on GitHub.",[254,424,426],{"className":256,"code":425,"filename":258,"language":259,"meta":260,"style":260},"mkdir -p .github\u002Fworkflows\ntouch .github\u002Fworkflows\u002Fcd.yml\n",[64,427,428,438],{"__ignoreMap":260},[264,429,430,432,435],{"class":266,"line":267},[264,431,271],{"class":270},[264,433,434],{"class":274}," -p",[264,436,437],{"class":274}," .github\u002Fworkflows\n",[264,439,440,443],{"class":266,"line":278},[264,441,442],{"class":270},"touch",[264,444,445],{"class":274}," .github\u002Fworkflows\u002Fcd.yml\n",[17,447,448,449,454,455,459,460,463,464,467],{},"In this file you should copy the default template of a ",[27,450,453],{"href":451,"rel":452},"https:\u002F\u002Fdocs.github.com\u002Fen\u002Ffree-pro-team@latest\u002Factions",[31],"GitHub action",", and use the ",[27,456,458],{"href":142,"rel":457},[31],"release-me-action",". Then you need to change the ",[64,461,462],{},"on"," key on the top of the file to ",[64,465,466],{},"milestone"," and only trigger when a milestone is closed.",[254,469,474],{"className":470,"code":471,"filename":472,"language":473,"meta":260,"style":260},"language-yaml shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","name: Continuous Deployment\n\non:\n  milestone:\n    types: [closed]\n\njobs:\n  deploy:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\u002Fcheckout@v2\n\n      - name: Create Release 🚀\n        uses: ridedott\u002Frelease-me-action@master\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n        with:\n          release-branches: '[\"main\"]'\n",".github\u002Fworkflows\u002Fcd.yml","yaml",[64,475,476,488,494,502,509,525,530,538,546,557,565,579,584,597,608,616,627,635],{"__ignoreMap":260},[264,477,478,482,485],{"class":266,"line":267},[264,479,481],{"class":480},"swJcz","name",[264,483,484],{"class":313},":",[264,486,487],{"class":274}," Continuous Deployment\n",[264,489,490],{"class":266,"line":278},[264,491,493],{"emptyLinePlaceholder":492},true,"\n",[264,495,496,499],{"class":266,"line":287},[264,497,462],{"class":498},"sfNiH",[264,500,501],{"class":313},":\n",[264,503,504,507],{"class":266,"line":296},[264,505,506],{"class":480},"  milestone",[264,508,501],{"class":313},[264,510,511,514,516,519,522],{"class":266,"line":304},[264,512,513],{"class":480},"    types",[264,515,484],{"class":313},[264,517,518],{"class":313}," [",[264,520,521],{"class":274},"closed",[264,523,524],{"class":313},"]\n",[264,526,528],{"class":266,"line":527},6,[264,529,493],{"emptyLinePlaceholder":492},[264,531,533,536],{"class":266,"line":532},7,[264,534,535],{"class":480},"jobs",[264,537,501],{"class":313},[264,539,541,544],{"class":266,"line":540},8,[264,542,543],{"class":480},"  deploy",[264,545,501],{"class":313},[264,547,549,552,554],{"class":266,"line":548},9,[264,550,551],{"class":480},"    runs-on",[264,553,484],{"class":313},[264,555,556],{"class":274}," ubuntu-latest\n",[264,558,560,563],{"class":266,"line":559},10,[264,561,562],{"class":480},"    steps",[264,564,501],{"class":313},[264,566,568,571,574,576],{"class":266,"line":567},11,[264,569,570],{"class":313},"      -",[264,572,573],{"class":480}," uses",[264,575,484],{"class":313},[264,577,578],{"class":274}," actions\u002Fcheckout@v2\n",[264,580,582],{"class":266,"line":581},12,[264,583,493],{"emptyLinePlaceholder":492},[264,585,587,589,592,594],{"class":266,"line":586},13,[264,588,570],{"class":313},[264,590,591],{"class":480}," name",[264,593,484],{"class":313},[264,595,596],{"class":274}," Create Release 🚀\n",[264,598,600,603,605],{"class":266,"line":599},14,[264,601,602],{"class":480},"        uses",[264,604,484],{"class":313},[264,606,607],{"class":274}," ridedott\u002Frelease-me-action@master\n",[264,609,611,614],{"class":266,"line":610},15,[264,612,613],{"class":480},"        env",[264,615,501],{"class":313},[264,617,619,622,624],{"class":266,"line":618},16,[264,620,621],{"class":480},"          GITHUB_TOKEN",[264,623,484],{"class":313},[264,625,626],{"class":274}," ${{ secrets.GITHUB_TOKEN }}\n",[264,628,630,633],{"class":266,"line":629},17,[264,631,632],{"class":480},"        with",[264,634,501],{"class":313},[264,636,638,641,643,646,649],{"class":266,"line":637},18,[264,639,640],{"class":480},"          release-branches",[264,642,484],{"class":313},[264,644,645],{"class":313}," '",[264,647,648],{"class":274},"[\"main\"]",[264,650,651],{"class":313},"'\n",[17,653,654],{},"Now let's commit the new file and push it to GitHub.",[254,656,658],{"className":256,"code":657,"filename":258,"language":259,"meta":260,"style":260},"git add .\ngit cz\ngit push origin main\n",[64,659,660,670,676],{"__ignoreMap":260},[264,661,662,664,667],{"class":266,"line":267},[264,663,290],{"class":270},[264,665,666],{"class":274}," add",[264,668,669],{"class":274}," .\n",[264,671,672,674],{"class":266,"line":278},[264,673,290],{"class":270},[264,675,397],{"class":274},[264,677,678,680,683,686],{"class":266,"line":287},[264,679,290],{"class":270},[264,681,682],{"class":274}," push",[264,684,685],{"class":274}," origin",[264,687,688],{"class":274}," main\n",[17,690,691,692,695],{},"The last thing we need to do is to create a milestone in GitHub, then look at the ",[77,693,694],{},"Actions"," section and see our workflow, but we notice it doesn't run yet.",[17,697,698],{},[99,699],{"alt":700,"className":701,"src":702},"GitHub Actions When Milestone Is Open",[103,104],"\u002Fposts\u002F2020\u002Freleasing-software-is-hard\u002Fgithub-actions-when-milestone-is-open.webp",[17,704,705,706,709,710,713],{},"Then let's close the milestone (just hit the ",[64,707,708],{},"close"," button), and refresh the ",[77,711,712],{},"Action"," tab.",[17,715,716],{},[99,717],{"alt":718,"className":719,"src":720},"GitHub Actions After Milestone Closed",[103,104],"\u002Fposts\u002F2020\u002Freleasing-software-is-hard\u002Fgithub-actions-after-milestone-closed.webp",[17,722,723,724,727],{},"And when the workflow finishes running, let's open the releases page and see our new release (you can notice the action also created a ",[64,725,726],{},"changelog.md"," file with all the changes, and it'll update this file with every release).",[17,729,730],{},[99,731],{"alt":732,"className":733,"src":734},"GitHub Releases After Action Completed",[103,104],"\u002Fposts\u002F2020\u002Freleasing-software-is-hard\u002Fgithub-releases-after-action-completed.webp",[35,736,738],{"id":737},"_6-summary","6. Summary",[17,740,741,742,744,745,748,749,752,753,756],{},"To recap, we now release our software automatically without any human intervention except to ",[64,743,708],{}," the milestone (we can easily change it on the GitHub workflow). Our commit messages are nicely organized with ",[27,746,193],{"href":191,"rel":747},[31]," by the ",[27,750,184],{"href":182,"rel":751},[31]," specification. Our release happens automatically with GitHub actions. And the release itself is generated with ",[27,754,127],{"href":125,"rel":755},[31]," - the next version number, the release notes and the publishing itself to GitHub releases.",[17,758,759,760,764],{},"If you want to see it all happen or maybe got stuck along the way, just go over to the ",[27,761,245],{"href":762,"rel":763},"https:\u002F\u002Fgithub.com\u002Fnirgn975\u002Fdeweb",[31]," repo on GitHub and check out the code.",[766,767,768],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}",{"title":260,"searchDepth":278,"depth":278,"links":770},[771,772,773,774,775,776],{"id":37,"depth":278,"text":38},{"id":108,"depth":278,"text":109},{"id":175,"depth":278,"text":176},{"id":234,"depth":278,"text":235},{"id":407,"depth":278,"text":408},{"id":737,"depth":278,"text":738},"2020-12-01","Automating versioning and releases with Semantic Versioning and semantic-release.",false,"md",{"src":782},"\u002Fposts\u002F2020\u002Freleasing-software-is-hard\u002Fsoftware-development.webp",{"excerpt":784},{"type":14,"value":785},[786,788,790],[17,787,19],{},[17,789,22],{},[17,791,25,792,33],{},[27,793,32],{"href":29,"rel":794},[31],"\u002Fblog\u002F2020\u002Freleasing-software-is-hard",{"title":5,"description":778},"blog\u002F2020\u002Freleasing-software-is-hard","2RF-OkKXWA0LRhRRXQP87RuYZp3iGp5xWfhhFCJK4G8",[800,805],{"title":801,"path":802,"stem":803,"description":804,"children":-1},"Passive.. Passive Recon.. Passive Reconnaissance.. OSINT!","\u002Fblog\u002F2020\u002Fopen-source-intelligence","blog\u002F2020\u002Fopen-source-intelligence","A hands-on walkthrough of passive reconnaissance and OSINT techniques.",{"title":806,"path":807,"stem":808,"description":809,"children":-1},"Hugo Theme With Developer Focus In Mind","\u002Fblog\u002F2021\u002Fhugo-theme","blog\u002F2021\u002Fhugo-theme","Introducing devRes, a developer-focused Hugo resume theme.",1786001638688]