diff --git a/.github/workflows/build-release-zip.yml b/.github/workflows/build-release-zip.yml index 3043e17..ff6fb88 100644 --- a/.github/workflows/build-release-zip.yml +++ b/.github/workflows/build-release-zip.yml @@ -14,17 +14,6 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Cache vendor - id: cache-composer - uses: actions/cache@v3 - env: - cache-name: cache-vendor - with: - path: | - vendor - ~/.composer/cache - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.json') }} - - name: Cache node_modules id: cache-node-modules uses: actions/cache@v3 @@ -44,22 +33,8 @@ jobs: if: steps.cache-node-modules.outputs.cache-hit != 'true' run: npm ci --no-optional - - name: Install Composer dependencies - if: steps.cache-vendor.outputs.cache-hit != 'true' - run: composer install --no-dev - - name: Build plugin run: npm run build - name: Generate ZIP file - run: bash bin/build-zip.sh - - - name: Unzip the file (prevents double zip problem) - run: unzip ${{ github.event.repository.name }}.zip -d zipfile - - - name: Upload the ZIP file as an artifact - uses: actions/upload-artifact@v3 - with: - name: ${{ github.event.repository.name }} - path: zipfile - retention-days: 5 + uses: 10up/action-wordpress-plugin-build-zip@stable diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 761f6f5..ced5407 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -71,8 +71,9 @@ Head to the Pages list table and drag and drop pages to change the order. Refres 6. Readme updates: Make any other readme changes as necessary. `README.md` is geared toward GitHub and `readme.txt` contains WordPress.org-specific content. The two are slightly different. 7. Merge: Make a non-fast-forward merge from your release branch to `develop` (or merge the pull request), then do the same for `develop` into `trunk` (`git checkout trunk && git merge --no-ff develop`). `trunk` contains the stable development version. 8. Push: Push your `trunk` branch to GitHub (e.g. `git push origin trunk`). -9. Release: Create a [new release](https://github.com/10up/simple-page-ordering/releases/new), naming the tag and the release with the new version number, and targeting the `trunk` branch. Paste the changelog from `CHANGELOG.md` into the body of the release and include a link to the closed issues on the [X.Y.Z milestone](https://github.com/10up/simple-page-ordering/milestone/#?closed=1). The release should now appear under [releases](https://github.com/10up/simple-page-ordering/releases) and in the WordPress admin as an update as well. -10. SVN: Wait for the [GitHub Action](https://github.com/10up/simple-page-ordering/actions) to finish deploying to the WordPress.org repository. If all goes well, users with SVN commit access for that plugin will receive an emailed diff of changes. -11. Check WordPress.org: Ensure that the changes are live on https://wordpress.org/plugins/simple-page-ordering/. This may take a few minutes. -12. Close milestone: Edit the [X.Y.Z milestone](https://github.com/10up/simple-page-ordering/milestone/#) with release date (in the `Due date (optional)` field) and link to GitHub release (in the `Description field`), then close the milestone. -13. Punt incomplete items: If any open issues or PRs which were milestoned for `X.Y.Z` do not make it into the release, update their milestone to `X.Y.Z+1`, `X.Y+1.0`, `X+1.0.0` or `Future Release`. +9. Test the pre-release ZIP locally by downloading it from the **Build release zip** action artifact to ensure the plugin doesn't break after release. +10. Release: Create a [new release](https://github.com/10up/simple-page-ordering/releases/new), naming the tag and the release with the new version number, and targeting the `trunk` branch. Paste the changelog from `CHANGELOG.md` into the body of the release and include a link to the closed issues on the [X.Y.Z milestone](https://github.com/10up/simple-page-ordering/milestone/#?closed=1). The release should now appear under [releases](https://github.com/10up/simple-page-ordering/releases) and in the WordPress admin as an update as well. +11. SVN: Wait for the [GitHub Action](https://github.com/10up/simple-page-ordering/actions) to finish deploying to the WordPress.org repository. If all goes well, users with SVN commit access for that plugin will receive an emailed diff of changes. +12. Check WordPress.org: Ensure that the changes are live on https://wordpress.org/plugins/simple-page-ordering/. This may take a few minutes. +13. Close milestone: Edit the [X.Y.Z milestone](https://github.com/10up/simple-page-ordering/milestone/#) with release date (in the `Due date (optional)` field) and link to GitHub release (in the `Description field`), then close the milestone. +14. Punt incomplete items: If any open issues or PRs which were milestoned for `X.Y.Z` do not make it into the release, update their milestone to `X.Y.Z+1`, `X.Y+1.0`, `X+1.0.0` or `Future Release`. diff --git a/bin/build-zip.sh b/bin/build-zip.sh deleted file mode 100644 index cf75b69..0000000 --- a/bin/build-zip.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/sh - -# Note that this does not use pipefail -# because if the grep later doesn't match any deleted files, -# which is likely the majority case, -# it does not exit with a 0, and we only care about the final exit. -set -eo - -# Allow some ENV variables to be customized -if [[ -z "$SLUG" ]]; then - SLUG=${GITHUB_REPOSITORY#*/} -fi -echo "ℹ︎ SLUG is $SLUG" - -if [[ -z "$BUILD_DIR" ]] || [[ $BUILD_DIR == "./" ]]; then - BUILD_DIR=false -elif [[ $BUILD_DIR == ./* ]]; then - BUILD_DIR=${BUILD_DIR:2} -fi - -if [[ "$BUILD_DIR" != false ]]; then - if [[ $BUILD_DIR != /* ]]; then - BUILD_DIR="${GITHUB_WORKSPACE%/}/${BUILD_DIR%/}" - fi - echo "ℹ︎ BUILD_DIR is $BUILD_DIR" -fi - -SVN_URL="https://plugins.svn.wordpress.org/${SLUG}/" -SVN_DIR="${HOME}/svn-${SLUG}" - -# Checkout just trunk for efficiency -# Tagging will be handled on the SVN level -echo "➤ Checking out .org repository..." -svn checkout --depth immediates "$SVN_URL" "$SVN_DIR" -cd "$SVN_DIR" -svn update --set-depth infinity trunk - -if [[ "$BUILD_DIR" = false ]]; then - echo "➤ Copying files..." - if [[ -e "$GITHUB_WORKSPACE/.distignore" ]]; then - echo "ℹ︎ Using .distignore" - # Copy from current branch to /trunk, excluding dotorg assets - # The --delete flag will delete anything in destination that no longer exists in source - rsync -rc --exclude-from="$GITHUB_WORKSPACE/.distignore" "$GITHUB_WORKSPACE/" trunk/ --delete --delete-excluded - else - echo "ℹ︎ Using .gitattributes" - - cd "$GITHUB_WORKSPACE" - - # "Export" a cleaned copy to a temp directory - TMP_DIR="${HOME}/archivetmp" - mkdir "$TMP_DIR" - - git config --global user.email "10upbot+github@10up.com" - git config --global user.name "10upbot on GitHub" - - # If there's no .gitattributes file, write a default one into place - if [[ ! -e "$GITHUB_WORKSPACE/.gitattributes" ]]; then - cat > "$GITHUB_WORKSPACE/.gitattributes" <<-EOL - /.gitattributes export-ignore - /.gitignore export-ignore - /.github export-ignore - EOL - - # Ensure we are in the $GITHUB_WORKSPACE directory, just in case - # The .gitattributes file has to be committed to be used - # Just don't push it to the origin repo :) - git add .gitattributes && git commit -m "Add .gitattributes file" - fi - - # This will exclude everything in the .gitattributes file with the export-ignore flag - git archive HEAD | tar x --directory="$TMP_DIR" - - cd "$SVN_DIR" - - # Copy from clean copy to /trunk, excluding dotorg assets - # The --delete flag will delete anything in destination that no longer exists in source - rsync -rc "$TMP_DIR/" trunk/ --delete --delete-excluded - fi -else - echo "ℹ︎ Copying files from build directory..." - rsync -rc "$BUILD_DIR/" trunk/ --delete --delete-excluded -fi - -echo "➤ Generating zip file..." -cd "$SVN_DIR/trunk" || exit -zip -r "${GITHUB_WORKSPACE}/${SLUG}.zip" . -echo "zip-path=${GITHUB_WORKSPACE}/${SLUG}.zip" >> "${GITHUB_OUTPUT}" -echo "✓ Zip file generated!"