Giter VIP home page Giter VIP logo

deploy-to-azure's Introduction

Deploy to Azure

Create two deployment workflows using GitHub Actions and Microsoft Azure.

Step 1: Trigger a job based on labels

Welcome to the course 🎉

Screen Shot 2022-06-07 at 4 01 43 PM

A lot of things go into delivering "continuously". These things can range from culture and behavior to specific automation. In this exercise, we're going to focus on the deployment part of our automation.

In a GitHub Actions workflow, the on step defines what causes the workflow to run. In this case, we want the workflow to run different tasks when specific labels are applied to a pull request.

We'll use labels as triggers for multiple tasks:

  • When someone applies a "spin up environment" label to a pull request, that'll tell GitHub Actions that we'd like to set up our resources on an Azure environment.
  • When someone applies a "stage" label to a pull request, that'll be our indicator that we'd like to deploy our application to a staging environment.
  • When someone applies a "destroy environment" label to a pull request, we'll tear down any resources that are running on our Azure account.

⌨️ Activity 1: Configure GITHUB_TOKEN permissions

At the start of each workflow run, GitHub automatically creates a unique GITHUB_TOKEN secret to use in your workflow. We need to make sure this token has the permissions required for this course.

  1. Open a new browser tab, and work on the steps in your second tab while you read the instructions in this tab.
  2. Go to Settings > Actions > General. Ensure that the GITHUB_TOKEN also has Read and write permissions enabled under Workflow permissions. This is required for your workflow to be able to upload your image to the container registry.

⌨️ Activity 2: Configure a trigger based on labels

For now, we'll focus on staging. We'll spin up and destroy our environment in a later step.

  1. Go to the Actions tab.

  2. Click New workflow

  3. Search for "simple workflow" and click Configure

  4. Name your workflow deploy-staging.yml

  5. Edit the contents of this file and remove all triggers and jobs.

  6. Edit the contents of the file to add a conditional that filters the build job when there is a label present called stage. Your resulting file should look like this:

    name: Stage the app
    
    on:
      pull_request:
        types: [labeled]
    
    jobs:
      build:
        runs-on: ubuntu-latest
    
        if: contains(github.event.pull_request.labels.*.name, 'stage')
  7. Click Start commit, and choose to make a new branch named staging-workflow.

  8. Click Propose changes.

  9. Click Create pull request.

  10. Wait about 20 seconds then refresh this page (the one you're following instructions from). GitHub Actions will automatically update to the next step.


Get help: Post in our discussion boardReview the GitHub status page

© 2023 GitHub • Code of ConductMIT License

deploy-to-azure's People

Contributors

ger1964jou avatar

Stargazers

 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.