From 8a599c201635409b5cf66013e73f1c365b443fba Mon Sep 17 00:00:00 2001 From: Bernie Reiter <ockham@raz.or.at> Date: Wed, 18 Dec 2024 13:17:28 +0100 Subject: [PATCH] Create new workflow for job --- .../workflows/sync-assets-to-plugin-repo.yml | 44 +++++++++++++++++++ .../upload-release-to-plugin-repo.yml | 37 ---------------- 2 files changed, 44 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/sync-assets-to-plugin-repo.yml diff --git a/.github/workflows/sync-assets-to-plugin-repo.yml b/.github/workflows/sync-assets-to-plugin-repo.yml new file mode 100644 index 0000000000000..2387a907fe872 --- /dev/null +++ b/.github/workflows/sync-assets-to-plugin-repo.yml @@ -0,0 +1,44 @@ +name: Sync Gutenberg plugin assets to WordPress.org plugin repo + +on: + push: + branches: + - trunk + paths: + - assets + +jobs: + sync-assets: + name: Sync assets to WordPress.org plugin repo + runs-on: ubuntu-latest + environment: wp.org plugin + env: + PLUGIN_REPO_URL: 'https://plugins.svn.wordpress.org/gutenberg' + SVN_USERNAME: ${{ secrets.SVN_USERNAME }} + SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} + + steps: + - name: Check out Gutenberg assets folder from WP.org plugin repo + run: | + svn checkout "$PLUGIN_REPO_URL/assets" \ + --username "$SVN_USERNAME" --password "$SVN_PASSWORD" + + - name: Delete everything + working-directory: ./assets + run: find assets -type f -not -path 'assets/.svn/*' -delete + + - name: Checkout assets from current release + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + sparse-checkout: | + assets + show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} + + - name: Commit the updated assets + run: | + svn st | awk '/^?/ {print $2}' | xargs -r svn add + svn st | awk '/^!/ {print $2}' | xargs -r svn rm + svn commit assets \ + -m "Sync assets for version $VERSION" \ + --no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD" \ + --config-option=servers:global:http-timeout=600 diff --git a/.github/workflows/upload-release-to-plugin-repo.yml b/.github/workflows/upload-release-to-plugin-repo.yml index 8a2386a3420f3..4d2b0a66a7e7d 100644 --- a/.github/workflows/upload-release-to-plugin-repo.yml +++ b/.github/workflows/upload-release-to-plugin-repo.yml @@ -248,40 +248,3 @@ jobs: svn import "$VERSION" "$PLUGIN_REPO_URL/tags/$VERSION" -m "Committing version $VERSION" \ --no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD" \ --config-option=servers:global:http-timeout=300 - - sync-assets: - name: Sync assets - runs-on: ubuntu-latest - environment: wp.org plugin - if: ${{ github.event.release.assets[0] }} - env: - PLUGIN_REPO_URL: 'https://plugins.svn.wordpress.org/gutenberg' - SVN_USERNAME: ${{ secrets.svn_username }} - SVN_PASSWORD: ${{ secrets.svn_password }} - VERSION: ${{ github.event.release.name }} - - steps: - - name: Check out Gutenberg assets folder from WP.org plugin repo - run: | - svn checkout "$PLUGIN_REPO_URL/assets" assets \ - --username "$SVN_USERNAME" --password "$SVN_PASSWORD" - - - name: Delete everything - working-directory: ./assets - run: find assets -type f -not -path 'assets/.svn/*' -delete - - - name: Checkout assets from current release - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - sparse-checkout: | - assets - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Commit the updated assets - run: | - svn st | awk '/^?/ {print $2}' | xargs -r svn add - svn st | awk '/^!/ {print $2}' | xargs -r svn rm - svn commit "assets" \ - -m "Sync assets for version $VERSION" \ - --no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD" \ - --config-option=servers:global:http-timeout=600