codeLabs-summer2021 / 3D-Model-World

A real world environment to place, view, and share all your 3D models.
https://3d-model-world.netlify.app/
2 stars 0 forks source link

CD with Netlify & Github Actions #20

Closed randrade8311 closed 3 years ago

randrade8311 commented 3 years ago

After forking this repo and deploying it to Netlify, I found two ways to have the app continuously deploy:

  1. Directly through Netlify:
    • Make a Netlify account (https://app.netlify.com/)
    • Click on the "Create a new site" button
    • Connect to Github
    • Allow access to a specific repository or to all repositories
    • Choose the repository which will be deployed
    • Choose owner
    • Choose branch which will be deployed
    • Add build Command (If needed)
    • Add publish directory (If needed)
    • Add environment variables (If needed) (API keys and so on)
    • When ready, click "Deploy site"

Whenever a push occurs to the branch of your choice it will redeploy.

  1. Deploy through Github Actions:
    • Complete all steps from step 1
    • Go to Github repo
    • Click on actions in the navigation bar
    • Click on either a template or "set up a workflow yourself"
    • Set up the yml file:
    • Change the name of the workflow
    • "on" refers to when do you want the workflow to be triggered
    • "jobs" refers to what do you want tasks do you want to have performed
    • "runs-on" refers to what machine it will run on
    • "steps" are the tasks that will be executed in each job
    • Set up Netlify:
    • Search up "netlify actions" on marketplace search
    • Add publish directory
    • Add production branch
    • Add deploy message (Optional)
    • Add Netlify site Id
    • Add Netlify auth token
    • Keep site Id and auth token secret:
      • Go to repo settings
      • Click on "secrets"
      • Add new repo secret
      • Add App Id:
      • Go to Netlify
      • Go to site settings
      • Get API ID
      • Add as value to secret
      • Add auth token
      • Add new repo secret
      • Go to Netlify
      • Click on your account
      • Click on user settings
      • Click on applications
      • Create a new personal access token
      • Name token
      • copy the token
      • Place as the value in Github secret
      • Commit changes After completing all the steps, the action that was set up should run and deploy the app on Netlify. You can head over and check the most current build and it should display the most current commit message.

Also, since Github actions will trigger the new deployment, you can stop Netlify from deploying the app. You can do so by:

CalebMcOlin commented 3 years ago

Closed during repo overhaul.

Reason: Not relevant anymore.