Skip to content

Enable GitHub developers to deploy to Azure Storage using GitHub Actions

License

Notifications You must be signed in to change notification settings

tibor19/static-website-deploy

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Azure Static Website Action

This action was inspired by Azure Storage Action. I re-wrote the whole thing using node.js

Deploy Files to Azure Blob Storage

With Azure Static Website Action, you can automate your workflow to deploy files to Azure Blob Storage

End-to-End Sample Workflows

Dependencies on other Github Actions

  • Checkout your Git repository content into Github Actions agent.

Create Azure Storage Account and deploy static website using GitHub Actions

  1. Follow the tutorial to Create an Azure Storage Account
  2. Create an empty workflow (.yml file) in the .github/workflows/ folder of your repository.
  3. Copy the sample workflow into your workflow file.
  4. Change MyFolder to the relative path where your files are.
  5. Commit and push your repository.
  6. You should see a new GitHub Action started under Actions tab.

Sample workflow to deploy a Static Web Site to Azure Blob Storage

# File: .github/workflows/workflow.yml

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    steps: 
    - name: Checkout the code
      uses: actions/checkout@v3
    - name: Deploy the website
      uses: tibor19/static-website-deploy@v2
      with:
        enabled-static-website: 'true'
        folder: 'MyFolder'
        connection-string: ${{ secrets.CONNECTION_STRING }}

Configure connection string:

For any credentials like Azure Service Principal, Publish Profile, Connection Strings, etc add them as secrets in the GitHub repository and then use them in the workflow.

The above example uses the Connection String of your Azure Storage Account.

There are several ways to connect to your Azure Storage Account:

  • If you are using a connection string, you can use the following steps to configure the secret:

    • Follow the tutorial Configure Azure Storage connection strings.
    • Define a new secret as part of your repository or organization settings.
    • Give the secret a name ex CONNECTION_STRING.
    • Paste the connection string file into the secret's value field.
  • If you want to use an Azure AD identity, you need call az login, or run the azure/login action prior to this step, and specify the storage-account-name parameter. Make sure that the Azure AD identity has the Storage Account Contributor and Storage Blob Data Contributor roles on the storage account.

  • If you want to use a storage account key, then specify the storage-account-name and storage-account-key parameters.

About

Enable GitHub developers to deploy to Azure Storage using GitHub Actions

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published