Created
          April 4, 2021 21:12 
        
      - 
      
- 
        Save lonelydev/ae338222b1aa56840d616f1397b2fd79 to your computer and use it in GitHub Desktop. 
    Hugo Deploy
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | name: Hugo deploy | |
| on: | |
| push: | |
| branches: [main] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout blog repo with theme submodules | |
| uses: actions/checkout@v2 | |
| with: | |
| submodules: recursive | |
| - name: Run Hugo build with minified args | |
| uses: jakejarvis/[email protected] | |
| with: | |
| args: --minify | |
| - name: Login to Azure | |
| uses: azure/login@v1 | |
| with: | |
| creds: ${{ secrets.AZURE_CREDENTIALS }} | |
| - name: Upload to Azure blob storage | |
| uses: azure/CLI@v1 | |
| with: | |
| azcliversion: 2.0.72 | |
| inlineScript: | | |
| az storage blob delete-batch -s "\$web" --connection-string "${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}" | |
| az storage blob upload-batch -d "\$web" -s ./public --connection-string "${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}" | |
| - name: Purge CDN resources | |
| uses: azure/CLI@v1 | |
| with: | |
| azcliversion: 2.0.72 | |
| inlineScript: | | |
| az cdn endpoint purge --content-paths "/*" --profile-name ${{ secrets.AZURE_CDN_PROFILE_NAME }} --name ${{ secrets.AZURE_CDN_ENDPOINT }} --resource-group ${{ secrets.AZURE_BLOG_RESOURCE_GROUP }} --subscription ${{ secrets.AZURE_BLOG_SUBSCRIPTION_NAME }} --no-wait | |
| # Azure logout | |
| - name: Logout of Azure Session | |
| run: | | |
| az logout | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment