GitHub Actions on Azure
Replicate the CI/CD workflow using GitHub Actions with the azure/webapps-deploy action, and understand when to choose GitHub Actions over Azure Pipelines.
What Is GitHub Actions?
GitHub Actions is GitHub's built-in CI/CD and automation platform. Workflows are defined in YAML files stored in the .github/workflows/ directory of your repository and triggered by GitHub events — pushes, pull requests, releases, and more. GitHub Actions is deeply integrated with the GitHub ecosystem (issues, PRs, packages, security scanning) and provides a rich marketplace of community actions for tasks like building, testing, and deploying to Azure.
GitHub Actions Workflow Structure
A GitHub Actions workflow file has three top-level sections. on defines the trigger events. env sets global environment variables. jobs defines one or more jobs, each running on a runner (GitHub-hosted or self-hosted). Each job has steps — either run (shell script) or uses (a pre-built action). Jobs run in parallel by default; use needs to create sequential dependencies.
# .github/workflows/ci.yml
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
NODE_VERSION: '18.x'
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- run: npm ci
- run: npm test