Git Product home page Git Product logo

static-website-deploy's Introduction

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.

static-website-deploy's People

Contributors

dependabot[bot] avatar tibor19 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

static-website-deploy's Issues

Publish to a folder?

Would I be able to publish to a specific folder?

The use case is as follows. I run multiple open-source projects that are al documented at GitHub pages, but that doesn't allow me to publish the beta branch documentation.

Also PR requests that change the documentation should also be visible somewhere.

What I want to do is build the documentation and publish it to the storage account in the folder with the name of the branch. So storage.azurestorage.com/branch-name/index.html
That would make it easy to link to the beta docs or to publish some pr documentation.

Deploy only on one or a sub-folder

Hi Tiberiu,

It is not an issue per se. but How do we deploy only a subfolder content like "dist/"?
Our repository contains multiple folders or site data but data to be published is in the "dist" folder.

Can you guide how to do or use it?

Update to `node20`?

Hej!

Could it be possible for you to update your awesome action to node20? The pipeline constantly complains now, about depreciation of node16...

๐Ÿ™

is not a valid value for options.access. The valid values are: ["container","blob"].

Hi @tibor19

I just upgraded a working workflow from v1 to v2 and now, I get a weird error:

Error: is not a valid value for options.access. The valid values are: ["container","blob"]. at serializeEnumType (/home/runner/work/_actions/tibor19/static-website-deploy/v2/dist/index.js:2634:15) at Serializer.serialize (/home/runner/work/_actions/tibor19/static-website-deploy/v2/dist/index.js:2405:27) at getOperationArgumentValueFromParameterPath (/home/runner/work/_actions/tibor19/static-website-deploy/v2/dist/index.js:6897:24) at getOperationArgumentValueFromParameter (/home/runner/work/_actions/tibor19/static-website-deploy/v2/dist/index.js:6868:12) at StorageClientContext.sendOperationRequest (/home/runner/work/_actions/tibor19/static-website-deploy/v2/dist/index.js:6622:39) at Container.setAccessPolicy (/home/runner/work/_actions/tibor19/static-website-deploy/v2/dist/index.js:18899:28) at ContainerClient.setAccessPolicy (/home/runner/work/_actions/tibor19/static-website-deploy/v2/dist/index.js:30380:48) at main (/home/runner/work/_actions/tibor19/static-website-deploy/v2/dist/index.js:50698:32) at processTicksAndRejections (node:internal/process/task_queues:96:5)

https://github.com/lgmorand/workshop-aca/actions/runs/3938050173/jobs/6736280406#step:8:27

any idea?

Option to empty the storage before upload ?

Hi,

Thanks for this GH Action !

Is there an option to empty the storage before upload ?
I use this action to deploy the result of a VueJS build. Every important resulting assets names (JS and CSS files) are fingerprinted, and build after build, the Storage content is filling up.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.