Setup CI/CD Pipeline in Azure DevOps to deploy Eleventy website to Firebase Hosting

Eleventy logo from

Static sites developed using Eleventy are compiled during build time and stored in the /_site folder. This _site folder is then deployed (either manually or using pipelines) to a server like GitHub Pages or Firebase Hosting.

In this example, we will go over how to setup a CI/CD pipeline in Azure DevOps to deploy the static site built using 11ty to Firebase Hosting.


Before you continue, make sure you have an Eleventy project setup and source code is available in Azure DevOps Repos.

1. Setup Firebase tools (CLI)

Run the following command in Terminal/Command Prompt to install Firebase Tools:

npm install -g firebase-tools

Login to Firebase CLI

firebase login

2. Initialize your Firebase project within your Eleventy project

Navigate to your Eleventy project folder:


Run the following command from the root of your local project directory:

firebase init hosting

In this process, Firebase CLI will prompt to select your Firebase project and specify your public root directory.

Make sure to select the following options:

? What do you want to use as your public directory? _site
? Configure as a single-page app (rewrite all urls to /index.html)? No

3. Update package.json file and push your changes to your Azure DevOps Repository

Add the following scripts in your package.json file:

  "scripts": {
    "build": "npx @11ty/eleventy",
    "deploy": "npx @11ty/eleventy & firebase deploy",
    "start": "npx @11ty/eleventy  --serve"

4. Navigate to the Pipelines page in your Azure DevOps project

5. Update Pipeline YAML file

Replace the content of the starter YAML file with the following:

# Trigger the pipeline whenever new changes are pushed in dev branch
- dev

vmImage: ubuntu-latest


# Use this task to find, download, and cache a specified version of Node.js and add it to the PATH.
- task: NodeTool@0
versionSpec: 12.x
displayName: 'Install Node.js'

# Run 'npm install' to install packages defined in package.json
- task: Npm@1
command: 'install'
displayName: 'Install npm packages'

# Build 11ty project using 'npx @11ty/eleventy' command
- task: CmdLine@2
script: 'npm run build'
displayName: 'Build 11ty project'

# Install Firebase CLI tools
- task: CmdLine@2
script: 'npm install -g firebase-tools'
displayName: 'Install Firebase tools'

# Deploy the app to Firebase using the CI token stored in variables
- task: CmdLine@2
script: 'firebase deploy --token "$(FIREBASE_TOKEN)" -m "$(Build.BuildNumber)"'
displayName: 'Firebase publish -m "$(Build.BuildNumber)"'

6. Generate Firebase CI Token

To deploy a site to Firebase in a headless environment, we need to generate a refresh token.

Run the following command to generate a new token:

firebase login:ci

Copy the token from the output

7. Securely store the token in Azure DevOps

8. Run the pipeline

To make sure everything works fine, manually run the pipeline. It might take few minutes for the pipeline to run, depending on your website size.

9. Trigger the pipeline

Finally, to test the trigger, push some new changes to your dev branch. Once the changes are pushed, the pipeline will start automatically and deploy the app to Firebase Hosting.

If this post was helpful then don't forget to share it with others.

Share article