diff --git a/.github/workflows/artifact.yml b/.github/workflows/artifact.yml new file mode 100644 index 0000000000..96530ff041 --- /dev/null +++ b/.github/workflows/artifact.yml @@ -0,0 +1,13 @@ +name: Artifact test +on: + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/upload-artifact@v2 + with: + name: readme + path: README.md diff --git a/.github/workflows/build-website.yml b/.github/workflows/build-website.yml deleted file mode 100644 index 62aea15f10..0000000000 --- a/.github/workflows/build-website.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: Deploy to playground.wordpress.net - -on: - workflow_dispatch: - # Deploy the website every day at 9am and 6pm UTC - schedule: - - cron: '0 9,18 * * *' - -concurrency: - group: website-deployment - # TODO: Enable cancel-in-progress once we are deploying per commit? - #cancel-in-progress: true - -jobs: - build_and_deploy: - # Only run this workflow from the trunk branch and when it's triggered by another workflow OR dmsnell OR adamziel - if: > - github.ref == 'refs/heads/trunk' && ( - github.event_name == 'workflow_run' || - github.event_name == 'workflow_dispatch' || - github.actor == 'adamziel' || - github.actor == 'dmsnell' || - github.actor == 'bgrgicak' || - github.actor == 'brandonpayton' - ) - - # Specify runner + deployment step - runs-on: ubuntu-latest - environment: - name: playground-wordpress-net-wp-cloud - steps: - - uses: actions/checkout@v3 - - uses: ./.github/actions/prepare-playground - - run: npm run build - - - name: Deploy to playground.wordpress.net - shell: bash - run: | - mkdir -p ~/.ssh - echo "${{ secrets.DEPLOY_WEBSITE_TARGET_HOST_KEY }}" >> ~/.ssh/known_hosts - echo "${{ secrets.DEPLOY_WEBSITE_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 - chmod 0600 ~/.ssh/* - - # Website files - rsync -avz -e "ssh -i ~/.ssh/id_ed25519" --delete \ - dist/packages/playground/wasm-wordpress-net/ \ - ${{ secrets.DEPLOY_WEBSITE_TARGET_USER }}@${{ secrets.DEPLOY_WEBSITE_TARGET_HOST }}:'~/updated-playground-files' - - # Host-specific deployment scripts and server config - rsync -avz -e "ssh -i ~/.ssh/id_ed25519" --delete \ - packages/playground/website-deployment/ \ - ${{ secrets.DEPLOY_WEBSITE_TARGET_USER }}@${{ secrets.DEPLOY_WEBSITE_TARGET_HOST }}:'~/website-deployment' - - # Copy MIME types for use with PHP-served files - scp -i ~/.ssh/id_ed25519 \ - packages/php-wasm/universal/src/lib/mime-types.json \ - ${{ secrets.DEPLOY_WEBSITE_TARGET_USER }}@${{ secrets.DEPLOY_WEBSITE_TARGET_HOST }}:'~/website-deployment/' - - # Apply update - ssh -i ~/.ssh/id_ed25519 \ - ${{ secrets.DEPLOY_WEBSITE_TARGET_USER }}@${{ secrets.DEPLOY_WEBSITE_TARGET_HOST }} \ - -tt -C '~/website-deployment/apply-update.sh' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 11a17ef1c0..0000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,82 +0,0 @@ -name: CI -on: - push: - branches: - - trunk - pull_request: - -jobs: - # This step: - # * Warms up the node_modules cache - # * Performs linting and typechecking - # - # The linting tasks take ~5s to complete and it doesn't - # make sense to separate them into separate steps that would - # take ~25s just to run git clone and restore node_modules. - lint-and-typecheck: - name: 'Lint and typecheck' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: ./.github/actions/prepare-playground - - run: npx nx affected --target=lint - - run: npx nx affected --target=typecheck - test-unit: - runs-on: ubuntu-latest - needs: [lint-and-typecheck] - steps: - - uses: actions/checkout@v3 - - uses: ./.github/actions/prepare-playground - - run: node --expose-gc node_modules/nx/bin/nx affected --target=test --configuration=ci - test-e2e: - runs-on: ubuntu-latest - needs: [lint-and-typecheck] - # Run as root to allow node to bind to port 80 - steps: - - uses: actions/checkout@v3 - - uses: ./.github/actions/prepare-playground - - run: sudo ./node_modules/.bin/cypress install --force - - run: sudo CYPRESS_CI=1 npx nx e2e playground-website --configuration=ci --verbose - # Upload the Cypress screenshots as artifacts if the job fails - - uses: actions/upload-artifact@v2 - if: ${{ failure() }} - with: - name: cypress-screenshots - path: dist/cypress/packages/playground/website/screenshots - - build: - runs-on: ubuntu-latest - needs: [lint-and-typecheck] - steps: - - uses: actions/checkout@v3 - - uses: ./.github/actions/prepare-playground - - run: npx nx affected --target=build --parallel=3 --verbose - - # Deploy documentation job - deploy_docs: - if: github.ref == 'refs/heads/trunk' && github.event_name == 'push' - # Add a dependency to the build job - needs: [test-unit, test-e2e, build] - name: 'Deploy doc site' - - # Grant GITHUB_TOKEN the permissions required to make a Pages deployment - permissions: - pages: write # to deploy to Pages - id-token: write # to verify the deployment originates from an appropriate source - - # Deploy to the github-pages environment - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - - # Specify runner + deployment step - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: ./.github/actions/prepare-playground - - run: npm run build:docs - - uses: actions/upload-pages-artifact@v1 - with: { path: dist/docs/build } - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v2 diff --git a/.github/workflows/deploy-website.yml b/.github/workflows/deploy-website.yml deleted file mode 100644 index 9a98fc5b90..0000000000 --- a/.github/workflows/deploy-website.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Continue deploying to playground.wordpress.net (don't use manually) -# Sorry, the previous job just built it and uploaded it to GitHub - -on: - workflow_run: - workflows: [Deploy to playground.wordpress.net] - types: - - completed - -jobs: - build_and_deploy: - # Only run this workflow from the trunk branch and when it's triggered by another workflow OR dmsnell OR adamziel - if: > - github.ref == 'refs/heads/trunk' && ( - github.event.workflow_run.conclusion == 'success' || - github.actor == 'adamziel' || - github.actor == 'dmsnell' || - github.actor == 'bgrgicak' || - github.actor == 'brandonpayton' - ) - - # Specify runner + deployment step - runs-on: ubuntu-latest - environment: - name: playground-wordpress-net - steps: - # Deploy the latest website artifact to playground.wordpress.net website by - # sending a CURL request to https://playground.wordpress.net/webhook.php with a header - # like X-Deployment-Token that has the same value as github secret DEPLOY_AUTH_TOKEN - - name: Deploy - shell: bash - # Sleep to give the GitHub API time to register the artifact, - # otherwise the artifact will not be available when the webhook is called - run: | - while true; do - API_HASH=$(curl 'https://api.github.com/repos/wordpress/wordpress-playground/actions/artifacts?name=playground-website&per_page=2' \ - | jq -r '.artifacts[0].workflow_run.head_sha') - if [ "$API_HASH" = "$GITHUB_SHA" ]; then - break; - fi; - echo "$API_HASH was not $GITHUB_SHA, waiting 10 seconds..."; - sleep 10; - done; - curl -X POST https://playground.wordpress.net/webhook.php \ - -H "X-Deployment-Token: ${{ secrets.DEPLOYMENT_KEY }}" \ - -H "Content-Type: application/json" diff --git a/.github/workflows/publish-npm-packages.yml b/.github/workflows/publish-npm-packages.yml deleted file mode 100644 index 838061b7ec..0000000000 --- a/.github/workflows/publish-npm-packages.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Release NPM packages - -on: - workflow_dispatch: - # Require a version bump (patch, minor, major) and an optional dist tag - inputs: - version_bump: - description: 'Version bump (patch, minor, or major)' - required: true - default: 'patch' - dist_tag: - description: 'Dist tag (latest, next, etc.)' - required: false - default: 'latest' - -jobs: - release: - # Only run this workflow from the trunk branch and when it's triggered by dmsnell OR adamziel - if: > - github.ref == 'refs/heads/trunk' && ( - github.actor == 'adamziel' || - github.actor == 'dmsnell' || - github.actor == 'bgrgicak' || - github.actor == 'brandonpayton' - ) - - # Specify runner + deployment step - runs-on: ubuntu-latest - environment: - name: npm - env: - NPM_TOKEN: ${{ secrets.NPM_AUTOMATION_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - - uses: actions/checkout@v3 - with: - ref: ${{ github.event.pull_request.head.ref }} - clean: true - persist-credentials: false - - name: Config git user - run: | - git config --global user.name "deployment_bot" - git config --global user.email "deployment_bot@users.noreply.github.com" - git remote set-url origin https://${{ secrets.GH_ACTOR }}:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }} - - name: Authenticate with Registry - run: | - echo "@php-wasm:registry=https://registry.npmjs.org/" > ~/.npmrc - echo "@wp-playground:registry=https://registry.npmjs.org/" >> ~/.npmrc - echo "registry=https://registry.npmjs.org/" >> ~/.npmrc - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc - - uses: ./.github/actions/prepare-playground - # Version bump, release, tag a new version on GitHub - - name: Release new version of NPM packages - shell: bash - run: npx lerna@6.6.2 publish ${{ inputs.version_bump }} --yes --no-private --loglevel=verbose --dist-tag=${{ inputs.dist_tag }} diff --git a/.github/workflows/refresh-sqlite-integration.yml b/.github/workflows/refresh-sqlite-integration.yml deleted file mode 100644 index 6088e40f83..0000000000 --- a/.github/workflows/refresh-sqlite-integration.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: 'Refresh SQLite plugin' - -on: - workflow_dispatch: - # Every 20 minutes - schedule: - - cron: '0 9 * * *' - -jobs: - build_and_deploy: - # Only run this workflow from the trunk branch and when it's triggered by dmsnell OR adamziel - if: > - github.ref == 'refs/heads/trunk' && ( - github.actor == 'adamziel' || - github.actor == 'dmsnell' || - github.actor == 'bgrgicak' || - github.actor == 'brandonpayton' - ) - - runs-on: ubuntu-latest - environment: - name: wordpress-assets - concurrency: - group: check-version-and-run-build - steps: - - uses: actions/checkout@v3 - with: - ref: ${{ github.event.pull_request.head.ref }} - clean: true - persist-credentials: false - - uses: ./.github/actions/prepare-playground - - name: 'Refresh the SQLite bundle' - shell: bash - run: npx nx bundle-sqlite-database playground-wordpress-builds - - name: Check for uncommitted changes - id: changes - run: | - if [ -z "$(git status --porcelain)" ]; then - echo "No changes" - echo 'CHANGES=0' >> $GITHUB_OUTPUT - else - echo "Changes detected" - echo 'CHANGES=1' >> $GITHUB_OUTPUT - fi - - name: Push changes to GitHub - if: steps.changes.outputs.CHANGES == '1' - run: | - git config --global user.name "deployment_bot" - git config --global user.email "deployment_bot@users.noreply.github.com" - git remote set-url origin https://${{ secrets.GH_ACTOR }}:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }} - git add -A - git commit -a -m "Refresh SQLite integration plugin" - git pull --rebase - # Push if the pull did not result in a conflict - if [ $? -eq 0 ]; then - git push origin HEAD:trunk - fi; - - name: Deploy website - if: steps.changes.outputs.CHANGES == '1' - uses: benc-uk/workflow-dispatch@v1 - with: - workflow: build-website.yml - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/refresh-wordpress-major-and-beta.yml b/.github/workflows/refresh-wordpress-major-and-beta.yml deleted file mode 100644 index 7bf445c364..0000000000 --- a/.github/workflows/refresh-wordpress-major-and-beta.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: 'Refresh WordPress Major&Beta' - -on: - workflow_dispatch: - inputs: - force_rebuild: - description: 'Force rebuild of WordPress (true/false)' - required: false - default: 'false' - # Every 20 minutes - schedule: - - cron: '*/20 * * * *' - -jobs: - build_and_deploy: - # Only run this workflow from the trunk branch and when it's triggered by dmsnell OR adamziel - if: > - github.ref == 'refs/heads/trunk' && ( - github.actor == 'adamziel' || - github.actor == 'dmsnell' || - github.actor == 'bgrgicak' || - github.actor == 'brandonpayton' - ) - - runs-on: ubuntu-latest - environment: - name: wordpress-assets - concurrency: - group: check-version-and-run-build - steps: - - uses: actions/checkout@v3 - with: - ref: ${{ github.event.pull_request.head.ref }} - clean: true - persist-credentials: false - - uses: ./.github/actions/prepare-playground - - name: 'Recompile WordPress' - shell: bash - env: - FORCE_REBUILD: ${{ github.event.inputs.force_rebuild }} - run: npx nx bundle-wordpress:major-and-beta playground-wordpress-builds - - name: Check for uncommitted changes - id: changes - run: | - if [ -z "$(git status --porcelain)" ]; then - echo "No changes" - echo 'CHANGES=0' >> $GITHUB_OUTPUT - else - echo "Changes detected" - echo 'CHANGES=1' >> $GITHUB_OUTPUT - fi - - name: Push rebuilt WordPress to GitHub - if: steps.changes.outputs.CHANGES == '1' - run: | - git config --global user.name "deployment_bot" - git config --global user.email "deployment_bot@users.noreply.github.com" - git remote set-url origin https://${{ secrets.GH_ACTOR }}:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }} - git add -A - git commit -a -m "Recompile WordPress major and beta versions" - git pull --rebase - # Push if the pull did not result in a conflict - if [ $? -eq 0 ]; then - git push origin HEAD:trunk - fi; - - name: Deploy website - if: steps.changes.outputs.CHANGES == '1' - uses: benc-uk/workflow-dispatch@v1 - with: - workflow: build-website.yml - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/refresh-wordpress-nightly.yml b/.github/workflows/refresh-wordpress-nightly.yml deleted file mode 100644 index 79251256a1..0000000000 --- a/.github/workflows/refresh-wordpress-nightly.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: 'Refresh WordPress Nightly' - -on: - workflow_dispatch: - # Deploy the nightly version of WordPress every day at 8am UTC - schedule: - - cron: '0 8 * * *' - -jobs: - build_and_deploy: - # Only run this workflow from the trunk branch and when it's triggered by dmsnell OR adamziel - if: > - github.ref == 'refs/heads/trunk' && ( - github.actor == 'adamziel' || - github.actor == 'dmsnell' || - github.actor == 'bgrgicak' || - github.actor == 'brandonpayton' - ) - - runs-on: ubuntu-latest - environment: - name: wordpress-assets - steps: - - uses: actions/checkout@v3 - with: - ref: ${{ github.event.pull_request.head.ref }} - clean: true - persist-credentials: false - - uses: ./.github/actions/prepare-playground - - name: 'Recompile WordPress' - shell: bash - run: npx nx bundle-wordpress:nightly playground-wordpress-builds - - name: Config git user - run: | - git config --global user.name "deployment_bot" - git config --global user.email "deployment_bot@users.noreply.github.com" - git remote set-url origin https://${{ secrets.GH_ACTOR }}:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }} - git add -A - git commit -a -m "Refresh WordPress Nightly" - git pull --rebase - # Push if the pull did not result in a conflict - if [ $? -eq 0 ]; then - git push origin HEAD:trunk - fi; diff --git a/.github/workflows/update-changelog.yml b/.github/workflows/update-changelog.yml deleted file mode 100644 index 789500a051..0000000000 --- a/.github/workflows/update-changelog.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: Update CHANGELOG.md - -on: - workflow_dispatch: - inputs: - version: - description: 'Version to document in the changelog (unreleased, current, 0.7.0)' - required: true - default: 'current' - workflow_run: - workflows: [Release NPM packages] - types: - - completed - -jobs: - release: - # Only run this workflow from the trunk branch and when it's triggered by dmsnell OR adamziel - if: > - github.ref == 'refs/heads/trunk' && ( - github.event.workflow_run.conclusion == 'success' || - github.actor == 'adamziel' || - github.actor == 'dmsnell' || - github.actor == 'bgrgicak' || - github.actor == 'brandonpayton' - ) - - # Specify runner + deployment step - runs-on: ubuntu-latest - environment: - name: wordpress-assets - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - - uses: actions/checkout@v3 - with: - ref: trunk - clean: true - persist-credentials: false - - name: Fetch trunk - shell: bash - run: git fetch origin trunk --depth=1 - - name: 'Install bun (for the changelog)' - run: | - curl -fsSL https://bun.sh/install | bash - - name: '✏️ Generate release changelog' - run: | - ls ./ - PATH="${PATH}:${HOME}/.bun/bin" npm run changelog -- --version=${{ inputs.version }} - PATH="${PATH}:${HOME}/.bun/bin" bun packages/docs/site/bin/refresh-changelog.ts - - name: '📦 Commit and push changelog' - run: | - git config --global user.name "deployment_bot" - git config --global user.email "deployment_bot@users.noreply.github.com" - git remote set-url origin https://${{ secrets.GH_ACTOR }}:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }} - if [[ -n $(git status --porcelain CHANGELOG.md) ]]; then - git commit -m "chore: update changelog" \ - CHANGELOG.md \ - packages/docs/site/docs/*changelog*.md - git pull origin trunk --rebase - git push origin trunk - else - echo "No changes in CHANGELOG.md. Skipping commit and push." - fi