GithubHelp home page GithubHelp logo

github-actions-demo's Introduction

github-actions-demo

Prerequisites

  • An Azure account with an active subscription.
  • Visual Studio Code
  • Azure CLI
  • .NET 8.0 SDK

Setup Azure Environment

  1. In your terminal, run:
    az login
    Copy the value of the id: field to a safe place. We'll call this AZURE_SUBSCRIPTION_ID. Example:
    [
        {
        "environmentName": "AzureCloud",
        "homeTenantId": "ed9*****-****-4016-****-b***********0",
        "id": "d57*****-****-4ec3-****-ac8d84d029e2", # <-- Copy this id field
        "isDefault": true,
        "name": "ASD Lab",
        "state": "Enabled",
        "tenantId": "ed9*****-****-4016-****-b***********0",
        "user": {
            "name": "****.*****@******.com",
            "type": "user"
        }
        }
    ]
  2. In your terminal, run the command below to create the resource group. You can also use the azure portal to create the resource.
    az group create --location $LOCATION --name $RESOURCE_GROUP --subscription $AZURE_SUBSCRIPTION_ID
  3. In your terminal, run the command below to create the Azure App Service Plan. You can also use the azure portal to create the resource.
    az appservice plan create --resource-group $RESOURCE_GROUP --name $AZURE_APP_PLAN --is-linux --sku F1 --subscription $AZURE_SUBSCRIPTION_ID
  4. In your terminal, run the command below to create the Azure Web App. You can also use the azure portal to create the resource.
    az webapp create --resource-group $RESOURCE_GROUP --plan $AZURE_APP_PLAN --name $AZURE_WEBAPP_NAME -r "DOTNETCORE:8.0" --subscription $AZURE_SUBSCRIPTION_ID
  5. In your terminal, run the command below to create the Service Principal for deploying the app to the Azure App. Service. You can also use the azure portal to create the resource.
    az ad sp create-for-rbac --name "github-demo" --role contributor --scopes "/subscriptions/$AZURE_SUBSCRIPTION_ID/resourceGroups/$RESOURCE_GROUP/providers/Microsoft.Web/sites/$AZURE_WEBAPP_NAME"
    Copy the entire contents of the command's response, we'll call this AZURE_CREDENTIALS. Example:
    {
      "clientId": "<GUID>",
      "clientSecret": "<GUID>",
      "subscriptionId": "<GUID>",
      "tenantId": "<GUID>",
      (...)
    }

Setup GitHub

  1. Go to GitHub, click on this repository's Secrets and variables > Actions in the Settings tab.
  2. Click New repository secret.
  3. Name the secret AZURE_CREDENTIALS and paste the entire contents from the terminal command you entered previously.
  4. Click Add secret

github-actions-demo's People

Contributors

aporquez avatar

Watchers

 avatar  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.