<?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>DEV Community: Rachel </title>
    <description>The latest articles on DEV Community by Rachel  (@racheli).</description>
    <link>https://dev.to/racheli</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%2F661330%2Fb5fd3971-f211-4b9a-b938-181526677f03.jpg</url>
      <title>DEV Community: Rachel </title>
      <link>https://dev.to/racheli</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/racheli"/>
    <language>en</language>
    <item>
      <title>Deploy React apps to Netlify in a neater reapportion.</title>
      <dc:creator>Rachel </dc:creator>
      <pubDate>Fri, 03 Dec 2021 18:39:03 +0000</pubDate>
      <link>https://dev.to/racheli/deploy-react-apps-to-netlify-in-a-neater-reapportion-16fm</link>
      <guid>https://dev.to/racheli/deploy-react-apps-to-netlify-in-a-neater-reapportion-16fm</guid>
      <description>&lt;h3&gt;
  
  
  My Workflow
&lt;/h3&gt;

&lt;p&gt;Have everything run and built from the get-go on github by github actions whenever you push a commit and enjoy a smooth deployment on Netlify.&lt;/p&gt;

&lt;p&gt;With the previous in mind follow these steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create your react project as usual &lt;code&gt;npx create-react-app app_name&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Build using &lt;code&gt;npm run build&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Then go ahead and set your workflow, to generate a &lt;code&gt;.yml&lt;/code&gt; file.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a netlify.toml file and then add the following code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;[build]&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;&lt;code&gt;command = "npm run build"&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;publish = "build"&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Drag and drop your build folder into your netlify site.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Generate a personal access token on netlify by going in user settings, applications and copy it to github secret.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--H1HxuRbq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a7i5ztlyj3t6xpxytlpp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--H1HxuRbq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a7i5ztlyj3t6xpxytlpp.png" alt="Generate P_A_T token" width="880" height="281"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Copy Api ID from netlify site to github secrets.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nkmg9Qcf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qa766z98kpb88oaw4zek.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nkmg9Qcf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qa766z98kpb88oaw4zek.png" alt="Api key on netlify site settings" width="880" height="469"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create yaml file &amp;amp; add the tokens from secrets.&lt;/li&gt;
&lt;li&gt;Add netlify deploy -–prod to yaml file &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Submission Category:
&lt;/h3&gt;

&lt;p&gt;DIY Deployments.&lt;/p&gt;

&lt;h3&gt;
  
  
  Yaml File or Link to Code
&lt;/h3&gt;

&lt;p&gt;Add the .yml file as follows .github/workflows/name.yml in the project. For more reference see the official &lt;a href="https://docs.github.com/en/actions/learn-github-actions#creating-a-workflow-file"&gt;docs&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name: CI/CD

on:
  push:
    branches: [ your_branch_name ]
  pull_request:
    branches: [ your_branch_name ]


jobs:
  build:

    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [12.x, 14.x]

    steps:
    - name: Checkout repository
      uses: actions/checkout@v2

    - name: Set up Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}

    - name: Install dependencies
      run: npm install

    - name: Run the tests
      run: npm test 

    - name: Buil￼d
      run: npm run build

    - name: Deploy Site
      env:
        NETLIFY_SITE_ID: ${{ secrets.GITHUB_TOKEN_NAME }}
        NETLIFY_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN_NAME }}
      run: netlify deploy --prod
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Additional Resources / Info
&lt;/h3&gt;

&lt;p&gt;Github &lt;a href="https://github.com/Omoyi/Hackethon-github"&gt;repository&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Under &lt;a href="https://github.com/Omoyi/Hackethon-github/blob/main/LICENSE"&gt;MIT License&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy coding ^ ^&lt;/p&gt;

</description>
      <category>actionshackathon21</category>
      <category>react</category>
      <category>netlify</category>
      <category>github</category>
    </item>
  </channel>
</rss>
