After completing the first part we now have a Bicep Module Registry set up. Time to publish some modules!
This part will publish Bicep modules under the modules path to a Bicep registry as defined in bicepconfig.json. This is done using a GitHub Actions workflow and a wrapper script. The latest git tag will be used as the module version. In addition a 'latest' version of each module will be pushed.
To start of we have two modules:
- storage: a simple Storage Account
- containerapp: a demo Azure Container App
Due to the limited regional availabilty of Azure Container Apps we want to restrict which regions this module can be used in. As an example we restrict the allowed locations to only those in the European geography.
- Modify the template in modules/containerapp/main.bicep.
- Example: Update the
location
parameter to restrict allowed values
- Example: Update the
@allowed([
'northeurope'
'westeurope'
'germanywestcentral'
'uksouth'
])
param location string = 'westeurope'
- Commit, tag and push changes
git add 2-publish/modules/containerapp/main.bicep
git commit -m "fix: set allowed locations"
git tag 1.1.0
git push # push the commit
git push --tags # push the tags
This will trigger the bicep-publish workflow and publish the module to the registry.
❗ Note that each new tag pushed will trigger a new published version.
To see thew triggered run in GitHub, open your repo and go to Actions to see the latest run:
To see the published modules in the registry see this guide. The module will be listed as a repository in the registry:
✔️ You've now successfully:
- Updated a Bicep template
- Created a new version tag
- Published the module to the Bicep Module Registry
Continue to the next and final step to learn how to consume this module from the registry.