diff --git a/.github/workflows/azure-static-web-apps-purple-glacier-0a500d203.yml b/.github/workflows/azure-static-web-apps-purple-glacier-0a500d203.yml index c189fc26..ca412996 100644 --- a/.github/workflows/azure-static-web-apps-purple-glacier-0a500d203.yml +++ b/.github/workflows/azure-static-web-apps-purple-glacier-0a500d203.yml @@ -3,7 +3,7 @@ name: Azure Static Web Apps CI/CD on: push: tags: - - v*.*.* + - v[0-9]+.[0-9]+.[0-9]+* branches: - master pull_request: @@ -12,8 +12,8 @@ on: - master jobs: - build_and_deploy_job: - if: github.event_name == 'push' || startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'pull_request' && github.event.action != 'closed') + build_deploy_pullrequest: + if: github.event_name == 'pull_request' && github.event.action != 'closed' runs-on: ubuntu-latest name: Build and Deploy Job steps: @@ -26,11 +26,45 @@ jobs: uses: martinbeentjes/npm-get-version-action@v1.3.1 - name: Build And Deploy env: - PACKAGE_VERSION: "v${{ steps.package-version.outputs.current-version}}${{ startsWith(github.ref, 'refs/tags/v') && '' || '-preview' }}" + PACKAGE_VERSION: v${{ steps.package-version.outputs.current-version}}-beta-${{ github.event.pull_request.number }} id: builddeploy uses: Azure/static-web-apps-deploy@v1 with: - deployment_environment: ${{ startsWith(github.ref, 'refs/tags/v') && 'prod' || 'preview' }} + deployment_environment: "Beta" + azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_PURPLE_GLACIER_0A500D203 }} + repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments) + action: "upload" + ###### Repository/Build Configurations - These values can be configured to match your app requirements. ###### + # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig + app_location: "." # App source code path + api_location: "" # Api source code path - optional + output_location: "./demo_build" # Built app content directory - optional + app_build_command: "npm run build_demo" + ###### End of Repository/Build Configurations ###### + + build_deploy_release: + if: (github.event_name == 'push' || startsWith(github.ref, 'refs/tags/v')) && github.event_name != 'pull_request' + runs-on: ubuntu-latest + name: Build and Deploy Job + steps: + - uses: actions/checkout@v3 + with: + submodules: true + lfs: false + - name: get-npm-version + id: package-version + uses: martinbeentjes/npm-get-version-action@v1.3.1 + - name: Set release version + if: startsWith(github.ref, 'refs/tags/v') + run: echo "PACKAGE_VERSION=v${{ steps.package-version.outputs.current-version}}" >> $GITHUB_ENV + - name: Set preview version + if: startsWith(github.ref, 'refs/tags/v') != true + run: echo "PACKAGE_VERSION=v${{ steps.package-version.outputs.current-version}}-preview" >> $GITHUB_ENV + - name: Build And Deploy + id: builddeploy + uses: Azure/static-web-apps-deploy@v1 + with: + deployment_environment: ${{ startsWith(github.ref, 'refs/tags/v') && 'Production' || 'Preview' }} azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_PURPLE_GLACIER_0A500D203 }} repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments) action: "upload" diff --git a/.github/workflows/azure-static-website.yml b/.github/workflows/azure-static-website.yml index e4d913ac..4bb1f86a 100644 --- a/.github/workflows/azure-static-website.yml +++ b/.github/workflows/azure-static-website.yml @@ -110,52 +110,3 @@ jobs: az extension add -n storage-preview -y az storage blob upload-batch -s $DEMO_SOURCE_DIR -d $DEMO_DEST_DIR --account-name $ACCOUNT_NAME az storage blob upload-batch -s $DIST_SOURCE_DIR -d $DIST_DEST_DIR --account-name $ACCOUNT_NAME - deploy_release: - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') - runs-on: ubuntu-latest - name: build and deploy release version - permissions: - contents: read - id-token: write - steps: - - name: "Checkout Github Action" - uses: actions/checkout@master - - name: Setup Node 18.x - uses: actions/setup-node@v1 - with: - node-version: "18.x" - - name: get-npm-version - id: package-version - uses: martinbeentjes/npm-get-version-action@v1.3.1 - - name: Set env - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - - name: "build-library" - if: ${{ env.RELEASE_VERSION }} == "v${{ steps.package-version.outputs.current-version}}" - env: - PACKAGE_VERSION: "v${{ steps.package-version.outputs.current-version}}" - run: | - npm install - npm run build - npm run build_demo - npm run test --if-present - - name: azure login - uses: azure/login@v1 - with: - client-id: ${{ secrets.AZURE_CLIENT_ID }} - tenant-id: ${{ secrets.AZURE_TENANT_ID }} - subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - enable-AzPSSession: true - - name: deploy demo site to Azure static website - uses: azure/CLI@v1 - env: - ACCOUNT_NAME: stevodocs - DEMO_SOURCE_DIR: demo_build - DEMO_DEST_DIR: "$web/mgplus" - DIST_SOURCE_DIR: dist - DIST_DEST_DIR: "mgpluscdn/v${{ steps.package-version.outputs.current-version}}" - with: - azcliversion: 2.30.0 - inlineScript: | - az extension add -n storage-preview -y - az storage blob upload-batch -s $DEMO_SOURCE_DIR -d $DEMO_DEST_DIR --account-name $ACCOUNT_NAME - az storage blob upload-batch -s $DIST_SOURCE_DIR -d $DIST_DEST_DIR --account-name $ACCOUNT_NAME