I could successfully deploy my project into the production environment using the provided documentation https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/static-web-apps/bitbucket.md
pipelines:
branches:
main:
- step:
name: Deploy to test
deployment: test
script:
- pipe: microsoft/azure-static-web-apps-deploy:main
variables:
APP_LOCATION: '$BITBUCKET_CLONE_DIR'
OUTPUT_LOCATION: '$BITBUCKET_CLONE_DIR/dist'
API_TOKEN: $deployment_token​
But there are no information about how to deploy to other environments than production, e.g: staging, qa, release …
With Azure pipeline, the value can be set with the deployment_environment parameter.
Does anyone have a solution for it?
2
Answers
Just got this working earlier today. I ran into the same issue, looks like they only support Staging environments when using Github or Azure Pipelines. I was able to get this to work by creating multiple Static Web App resources in Azure Portal. Prod gets the "paid" version, develop branch gets the "free" version.
Here is what the pipelines YAML looks like:
Then I added a new
deployment_token_beta
to the repo deployment variables using the key from the second web appIf you are using azure static web apps with multiples slots like prod,staging/dev then you have to specify DEPLOYMENT_ENVIRONMENT in your bitbucket-pipelines.yml file
Example :
If you are using the multiple Static Web App resources then you can follow the answer provided by David Torres, you have to create tokens for each web and mention them in variables.
Thanks & Regards