Code Monkey home page Code Monkey logo

cicd-sample's Introduction

CICD

Steps to deploy a new site

  1. Create repository in GitHub by visiting repo.new

  2. Create code inside repository

  3. Generate Netlify site and connect to your GitHub repo

  4. Create a new Build Hook: Alt

  5. Add the Build Hook as a secret to GitHub: Alt

  6. On the repository page in Github go to Actions, click New Workflow then click set up a workflow yourself.

  7. Add a workflow similar to this. Note this executes on push to main. Ensure you have named your NETLIFY_BUILD_HOOK the same as the one in the script.

name: Trigger Netlify Build
on:
  push:
    branches:
      - main
jobs:
  build:
    name: Request Netlify Webhook
    runs-on: ubuntu-latest
    steps:
      - name: Curl request
        run: curl -X POST -d {} ${{secrets.NETLIFY_BUILD_HOOK}}
  1. Now you can run push a change and you should see your code deployed to Netlify.

Consider:

  • Try another script. You will need to add some other secrets and get the info from your site in Netlify. Also when you run the ng build (if an Angular app) then you'll need to make sure where the site is being built locally and adjust the build_directory accordingly as that would match the target directory on the server:
name: "Deploy"

on:
  pull_request:
    types: closed

jobs:
  deploy:
    if: github.event.pull_request.merged == true
    runs-on: ubuntu-latest
    name: "Deploy to Netlify"
    steps:
      - uses: actions/checkout@v3
      - uses: jsmrcaga/[email protected]
        with:
          NETLIFY_AUTH_TOKEN: ${{ secrets.MY_AUTH_TOKEN }}
          NETLIFY_SITE_ID: ${{ secrets.MY_SITE_ID }}
          NETLIFY_DEPLOY_TO_PROD: true
          build_directory: dist/hello-ci-cd/browser

cicd-sample's People

Contributors

uerbzr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.