<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Ryan Rizky</title>
    <description>The latest articles on Forem by Ryan Rizky (@ryanrizky).</description>
    <link>https://forem.com/ryanrizky</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F893354%2F382f8a43-8258-4c20-9617-e2dc836b4b89.jpg</url>
      <title>Forem: Ryan Rizky</title>
      <link>https://forem.com/ryanrizky</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ryanrizky"/>
    <language>en</language>
    <item>
      <title>How to Release a Service</title>
      <dc:creator>Ryan Rizky</dc:creator>
      <pubDate>Sun, 16 Jun 2024 07:36:15 +0000</pubDate>
      <link>https://forem.com/ryanrizky/how-to-release-service-5eaj</link>
      <guid>https://forem.com/ryanrizky/how-to-release-service-5eaj</guid>
      <description>&lt;ul&gt;
&lt;li&gt;What is Service?&lt;/li&gt;
&lt;li&gt;What is Release?&lt;/li&gt;
&lt;li&gt;What is Semantic Versioning?&lt;/li&gt;
&lt;li&gt;
Why use Semantic Versioning?

&lt;ul&gt;
&lt;li&gt;How to start&lt;/li&gt;
&lt;li&gt;Step by Step&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;



&lt;p&gt;In this post, I will explain how to release service using Semantic Versioning.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Service?
&lt;/h3&gt;

&lt;p&gt;In making an application some components make the application run properly. For example in an e-commerce application, there is a login process (login service), after login, we can see the dashboard (dashboard service), and when we want to buy goods we will checkout and make payments (payment service).&lt;br&gt;
Login, Dashboard, and Payment are what we call service.&lt;/p&gt;
&lt;h3&gt;
  
  
  What is Release?
&lt;/h3&gt;

&lt;p&gt;Release is the process of releasing a service. Before releasing a service, the service must usually undergo a testing and validation process to determine whether the service is ready to use.&lt;/p&gt;
&lt;h3&gt;
  
  
  What is Semantic Versioning?
&lt;/h3&gt;

&lt;p&gt;Semantic Versioning commonly abbreviated as SemVer is a way to give a version number to a service with the format [MAJOR].[MINOR].[PATCH]. example: 1.0.1&lt;br&gt;
A full explanation can be read &lt;a href="https://semver.org/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Why use Semantic Versioning?
&lt;/h3&gt;

&lt;p&gt;If there are many services in an application, SemVer will make it easier for us to manage dependencies or compatibility between services.&lt;/p&gt;
&lt;h2&gt;
  
  
  How to start
&lt;/h2&gt;

&lt;p&gt;It's quite simple to release a service using SemVer, we only need to do &lt;code&gt;git tag X.X.X&lt;/code&gt; on our service repository.&lt;/p&gt;

&lt;p&gt;However, I will not do that in this post. Instead, I will use the npm package called &lt;code&gt;standard-version&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;standard-version&lt;/code&gt; is a tool to create a version using SemVer and generate a &lt;code&gt;CHANGELOG&lt;/code&gt; file supported by &lt;a href="https://www.conventionalcommits.org/en/v1.0.0/" rel="noopener noreferrer"&gt;Conventional Commits.&lt;/a&gt; More details about the &lt;code&gt;standard-version&lt;/code&gt; can be found &lt;a href="https://www.npmjs.com/package/standard-version" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Step by Step
&lt;/h2&gt;

&lt;p&gt;Before releasing using the &lt;code&gt;standard-version&lt;/code&gt;, make sure the commit follows the Conventional Commit Message format.&lt;/p&gt;

&lt;p&gt;Install &lt;code&gt;standard-version&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; standard-version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the service repository, create 2 files. &lt;code&gt;version.json&lt;/code&gt; and &lt;code&gt;.versionrc&lt;/code&gt; and initialize the tag.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;version.json&lt;/code&gt; file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"0.1.0"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;.versionrc&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"bumpFiles"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"filename"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"version.json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"json"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"releaseCommitMessageFormat"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"chore(release): release {{currentTag}}"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Tag initialization.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git tag v0.1.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If all those steps above are done, test by committing. Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;// Make changes to the service repository, &lt;span class="k"&gt;then &lt;/span&gt;commit the changes.
git add &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"feat: test update feature"&lt;/span&gt;

// Then update the service version.
standard-version

// Check &lt;span class="k"&gt;if &lt;/span&gt;there are new tag and new commit.
git tag &lt;span class="nt"&gt;-l&lt;/span&gt;
git log &lt;span class="nt"&gt;--oneline&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Done, we successfully released the service.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>sre</category>
      <category>cicd</category>
    </item>
    <item>
      <title>First Post</title>
      <dc:creator>Ryan Rizky</dc:creator>
      <pubDate>Sun, 17 Jul 2022 13:23:09 +0000</pubDate>
      <link>https://forem.com/ryanrizky/first-post-bk0</link>
      <guid>https://forem.com/ryanrizky/first-post-bk0</guid>
      <description>&lt;p&gt;Hello World, this is my first post on dev.to. I hope I can write more articles here.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;test &lt;/span&gt;code
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"test code"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;test quote&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Thanks.&lt;/p&gt;

</description>
      <category>beginners</category>
    </item>
  </channel>
</rss>
