Skip to content

Latest commit

 

History

History
193 lines (151 loc) · 4.66 KB

usage-examples.md

File metadata and controls

193 lines (151 loc) · 4.66 KB

Usage examples

This document contains minimal usage examples for the reusable workflows in this repository.

Provision Azure resources using Terraform

Example workflow:

on:
  push:
    branches: [main]

jobs:
  provision:
    uses: equinor/ops-actions/.github/workflows/[email protected]
    with:
      environment: development
    secrets:
      AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
      AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
      AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
      ENCRYPTION_PASSWORD: ${{ secrets.ENCRYPTION_PASSWORD }}

Prerequisites:

Supported Terraform providers:

Name Source Version
Azure hashicorp/azurerm >= v3.20.0
AzAPI azure/azapi >= v1.3.0

Deploy Docker image to Azure Web App

Example workflow:

on:
  push:
    branches: [main]

jobs:
  build:
    uses: equinor/ops-actions/.github/workflows/[email protected]
    with:
      registry_name: crexampledev
    secrets:
      AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
      AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
      AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}

  deploy:
    needs: build
    uses: equinor/ops-actions/.github/workflows/[email protected]
    with:
      environment: development
      image: ${{ needs.build.outputs.image }}
      app_name: app-example-dev
    secrets:
      AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
      AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
      AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}

Prerequisites:

Deploy Python application to Azure Function App

Example workflow:

on:
  push:
    branches: [main]

jobs:
  build:
    uses: equinor/ops-actions/.github/workflows/[email protected]
    with:
      pip_install_target: .python_packages/lib/site-packages # Required

  deploy:
    needs: build
    uses: equinor/ops-actions/.github/workflows/[email protected]
    with:
      environment: development
      artifact_name: ${{ needs.build.outputs.artifact_name }}
      app_name: func-example-dev
    secrets:
      AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
      AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
      AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}

Prerequisites:

Deploy Python application to Azure Web App

Example workflow:

on:
  push:
    branches: [main]

jobs:
  build:
    uses: equinor/ops-actions/.github/workflows/[email protected]
    with:
      venv_path: antenv # Required
      pip_install_target: .python_packages/lib/site-packages # Required

  deploy:
    needs: build
    uses: equinor/ops-actions/.github/workflows/[email protected]
    with:
      environment: development
      artifact_name: ${{ needs.build.outputs.artifact_name }}
      app_name: app-example-dev
    secrets:
      AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
      AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
      AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}

Prerequisites:

Deploy .NET application to Azure Web App

Example workflow:

on:
  push:
    branches: [main]

jobs:
  build:
    uses: equinor/ops-actions/.github/workflows/[email protected]
    with:
      project: .

  deploy:
    needs: build
    uses: equinor/ops-actions/.github/workflows/[email protected]
    with:
      environment: development
      artifact_name: ${{ needs.build.outputs.artifact_name }}
      app_name: app-example-dev
    secrets:
      AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
      AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
      AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}

Prerequisites:

Deploy MkDocs site to GitHub Pages

Example workflow:

on:
  push:
    branches: [main]
    paths:
      - docs/**
      - mkdocs.yml

jobs:
  build:
    uses: equinor/ops-actions/.github/workflows/[email protected]

  deploy:
    needs: build
    uses: equinor/ops-actions/.github/workflows/[email protected]
    with:
      artifact_name: ${{ needs.build.outputs.artifact_name }}