Deploy #11
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: Deploy | |
| permissions: | |
| contents: read | |
| actions: read | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| dry_run: | |
| type: boolean | |
| description: 'Dry run mode (test without deploying)' | |
| required: false | |
| default: false | |
| jobs: | |
| build: | |
| if: ( github.actor == 'ManorHazaz' || github.actor == 'hein-obox' || github.actor == 'KingYes' || github.actor == 'arielk' || github.actor == 'nicoladj77' ) && startsWith( github.repository, 'elementor/' ) | |
| uses: ./.github/workflows/build.yml | |
| secrets: inherit | |
| deploy: | |
| needs: build | |
| if: needs.build.result == 'success' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Check build job status | |
| run: | | |
| echo "Build job result: ${{ needs.build.result }}" | |
| if [ "${{ needs.build.result }}" != "success" ]; then | |
| echo "ERROR: Build job did not complete successfully. Result: ${{ needs.build.result }}" | |
| echo "Build job may have been skipped due to conditional check." | |
| exit 1 | |
| fi | |
| - name: Preparing envs | |
| run: | | |
| echo "THEME_VERSION=$(cat package.json | jq -r '.version')" >> $GITHUB_ENV | |
| - name: Download Artifact | |
| id: download-artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: hello-elementor | |
| continue-on-error: true | |
| - name: Extract artifact | |
| run: | | |
| echo "Artifact download outcome: ${{ steps.download-artifact.outcome }}" | |
| if [ "${{ steps.download-artifact.outcome }}" != "success" ]; then | |
| echo "ERROR: Artifact download failed" | |
| echo "Check the build job logs to verify the artifact was uploaded" | |
| exit 1 | |
| fi | |
| echo "Current directory: $(pwd)" | |
| echo "Workspace contents after download:" | |
| ls -la | |
| echo "" | |
| echo "Searching for zip file:" | |
| HT_ZIP=$(find . -maxdepth 2 -name "hello-elementor-*.zip" -type f | head -1) | |
| if [ -z "$HT_ZIP" ]; then | |
| echo "ERROR: Zip file not found after artifact download" | |
| echo "Available files:" | |
| find . -maxdepth 2 -type f | head -20 | |
| exit 1 | |
| fi | |
| echo "Found zip file: $HT_ZIP" | |
| echo "Extracting zip file..." | |
| unzip -q "$HT_ZIP" -d . | |
| echo "Extraction complete" | |
| echo "" | |
| echo "Verifying hello-elementor directory:" | |
| if [ -d "hello-elementor" ]; then | |
| echo "SUCCESS: hello-elementor directory found" | |
| ls -la hello-elementor | head -10 | |
| else | |
| echo "ERROR: hello-elementor directory not found after extraction" | |
| echo "Zip file contents:" | |
| unzip -l "$HT_ZIP" | head -20 | |
| exit 1 | |
| fi | |
| - name: Validate changelog | |
| env: | |
| VERSION: ${{ env.THEME_VERSION }} | |
| run: | | |
| bash "${GITHUB_WORKSPACE}/.github/scripts/validate-changelog.sh" | |
| - name: Install SVN | |
| run: | | |
| sudo apt-get update -y | |
| sudo apt-get install -y subversion | |
| which svn | |
| svn --version | |
| - name: Publish to WordPress.org SVN (Dry Run) | |
| if: ${{ inputs.dry_run == true }} | |
| run: | | |
| bash "${GITHUB_WORKSPACE}/.github/scripts/publish-theme-to-wordpress-org-dry-run.sh" | |
| - name: Publish to WordPress.org SVN | |
| if: ${{ inputs.dry_run == false }} | |
| env: | |
| SVN_USERNAME: ${{ secrets.SVN_USERNAME }} | |
| SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} | |
| run: | | |
| bash "${GITHUB_WORKSPACE}/.github/scripts/publish-theme-to-wordpress-org.sh" | |
| - name: Send Slack Notification | |
| if: ${{ inputs.dry_run == false }} | |
| uses: ./.github/actions/theme-slack-notification-release | |
| with: | |
| CLOUD_SLACK_BOT_TOKEN: ${{ secrets.CLOUD_SLACK_BOT_TOKEN }} | |
| PACKAGE_VERSION: ${{ env.THEME_VERSION }} | |
| SLACK_CHANNEL: "#tmz-hello-delivery" |