└── .github └── workflows └── deploy.yml /.github/workflows/deploy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Deployment 3 | on: 4 | schedule: 5 | - cron: "0 5 * * *" 6 | workflow_dispatch: 7 | inputs: 8 | env: 9 | description: "Select environment to deploy to" 10 | type: choice 11 | required: false 12 | default: "stage & prod" 13 | options: 14 | - stage 15 | - prod 16 | - stage & prod 17 | jobs: 18 | set-state: 19 | runs-on: ubuntu-latest 20 | outputs: 21 | deploy_prod: ${{ github.event_name == 'schedule' || contains(format('{0}', github.event.inputs.env), 'prod') }} 22 | deploy_dev: ${{ github.event_name == 'schedule' || contains(format('{0}', github.event.inputs.env), 'stage') }} 23 | path_prefix: ${{ steps.get_path_prefix.outputs.path_prefix }} 24 | steps: 25 | - name: Checkout 26 | uses: actions/checkout@v3 27 | 28 | pre-build-dev: 29 | needs: [set-state] 30 | runs-on: ubuntu-latest 31 | if: github.event_name == 'schedule' || needs.set-state.outputs.deploy_dev == 'true' 32 | steps: 33 | - name: check dev azure connection string 34 | if: env.AIO_AZURE_DEV_CONNECTION_STRING == null 35 | run: | 36 | echo "::error::Please set the Azure Blob Storage connection string as AIO_AZURE_DEV_CONNECTION_STRING in Github Secrets" 37 | exit 1 38 | env: 39 | AIO_AZURE_DEV_CONNECTION_STRING: ${{ secrets.AIO_AZURE_DEV_CONNECTION_STRING }} 40 | 41 | build-dev: 42 | defaults: 43 | run: 44 | shell: bash 45 | needs: [set-state, pre-build-dev] 46 | runs-on: ubuntu-latest 47 | steps: 48 | - name: Checkout 49 | uses: actions/checkout@v3 50 | 51 | - name: Setup Node v16 for Yarn v3 52 | uses: actions/setup-node@v3 53 | with: 54 | node-version: "16.15.0" # Current LTS version 55 | - name: Deploy 56 | uses: AdobeDocs/adp-sitemap-generator@main 57 | with: 58 | enabled-static-website: "true" 59 | source: "public" 60 | target: "/" 61 | deploy-env: "dev" 62 | connection-string-non-main: ${{ secrets.AIO_AZURE_DEV_CONNECTION_STRING }} 63 | connection-string-main: ${{ secrets.AZURE_DEV_CONNECTION_STRING }} 64 | remove-existing-files: "true" 65 | exclude-subfolder: ${{ needs.set-state.outputs.exclude_subfolder }} 66 | public-access-policy: container 67 | 68 | pre-build-production: 69 | needs: [set-state] 70 | runs-on: ubuntu-latest 71 | if: github.event_name == 'schedule' || needs.set-state.outputs.deploy_prod == 'true' 72 | steps: 73 | - name: check prod azure connection string 74 | if: env.AIO_AZURE_PROD_CONNECTION_STRING == null 75 | run: | 76 | echo "::error::Please set the Azure Blob Storage connection string as AIO_AZURE_PROD_CONNECTION_STRING in Github Secrets" 77 | exit 1 78 | env: 79 | AIO_AZURE_PROD_CONNECTION_STRING: ${{ secrets.AIO_AZURE_PROD_CONNECTION_STRING }} 80 | 81 | build-production: 82 | defaults: 83 | run: 84 | shell: bash 85 | needs: [set-state, pre-build-production] 86 | runs-on: ubuntu-latest 87 | steps: 88 | - name: Checkout 89 | uses: actions/checkout@v3 90 | 91 | - name: Setup Node v16 for Yarn v3 92 | uses: actions/setup-node@v3 93 | with: 94 | node-version: "16.15.0" # Current LTS version 95 | - name: Deploy 96 | uses: AdobeDocs/adp-sitemap-generator@main 97 | with: 98 | enabled-static-website: "true" 99 | source: "public" 100 | target: "/" 101 | deploy-env: "prod" 102 | connection-string-non-main: ${{ secrets.AIO_AZURE_PROD_CONNECTION_STRING }} 103 | connection-string-main: ${{ secrets.AZURE_PROD_CONNECTION_STRING }} 104 | remove-existing-files: "true" 105 | exclude-subfolder: ${{ needs.set-state.outputs.exclude_subfolder }} 106 | public-access-policy: container 107 | --------------------------------------------------------------------------------