From 7249d62c6fb8a2d7fde06903515e4a85e402d0c6 Mon Sep 17 00:00:00 2001 From: faisal-alvi Date: Fri, 2 Dec 2022 21:41:10 +0530 Subject: [PATCH 1/3] Added "Build release zip" GitHub Action --- .github/workflows/build-release-zip.yml | 55 +++++++++++++++++++++++++ CONTRIBUTING.md | 1 + 2 files changed, 56 insertions(+) create mode 100644 .github/workflows/build-release-zip.yml diff --git a/.github/workflows/build-release-zip.yml b/.github/workflows/build-release-zip.yml new file mode 100644 index 00000000..4b08db47 --- /dev/null +++ b/.github/workflows/build-release-zip.yml @@ -0,0 +1,55 @@ +name: Build release zip + +on: + workflow_dispatch: + push: + branches: + - trunk + +jobs: + build: + name: Build release zip + runs-on: ubuntu-latest + steps: + - 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 + env: + cache-name: cache-node-modules + with: + path: node_modules + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + + - name: Setup node version and npm cache + uses: actions/setup-node@v3 + with: + node-version: 16 + cache: 'npm' + + - name: Install Node dependencies + if: steps.cache-node-modules.outputs.cache-hit != 'true' + run: npm install + + - 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 + uses: 10up/action-wordpress-plugin-build-zip@stable \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 93560a8a..b335dddf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -38,6 +38,7 @@ The `develop` branch is the development branch which means it contains the next - [ ] 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 latest stable release. - [ ] Test: Run through common tasks while on `trunk` to be sure it functions correctly. - [ ] Push: Push your `trunk` branch to GitHub (e.g. `git push origin trunk`). +- [ ] 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. - [ ] Release: Create a [new release](https://github.com/10up/simple-local-avatars/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 milestone](https://github.com/10up/simple-local-avatars/milestone/#?closed=1). - [ ] SVN: Wait for the [GitHub Action](https://github.com/10up/simple-local-avatars/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. - [ ] Check WordPress.org: Ensure that the changes are live on https://wordpress.org/plugins/simple-local-avatars/. This may take a few minutes. From 91cceb1d769680b59a8bcf587a58260719123e62 Mon Sep 17 00:00:00 2001 From: faisal-alvi Date: Mon, 5 Dec 2022 16:07:41 +0530 Subject: [PATCH 2/3] suggestions implemented --- .github/workflows/build-release-zip.yml | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/.github/workflows/build-release-zip.yml b/.github/workflows/build-release-zip.yml index 4b08db47..c74f9c05 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 @@ -52,4 +41,4 @@ jobs: run: npm run build - name: Generate ZIP file - uses: 10up/action-wordpress-plugin-build-zip@stable \ No newline at end of file + uses: 10up/action-wordpress-plugin-build-zip@stable From 182408b30fa820906454a476752592bfe8b2d0fc Mon Sep 17 00:00:00 2001 From: faisal-alvi Date: Mon, 5 Dec 2022 16:09:25 +0530 Subject: [PATCH 3/3] remove the composer install step --- .github/workflows/build-release-zip.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/build-release-zip.yml b/.github/workflows/build-release-zip.yml index c74f9c05..586e6aae 100644 --- a/.github/workflows/build-release-zip.yml +++ b/.github/workflows/build-release-zip.yml @@ -33,10 +33,6 @@ jobs: if: steps.cache-node-modules.outputs.cache-hit != 'true' run: npm install - - name: Install Composer dependencies - if: steps.cache-vendor.outputs.cache-hit != 'true' - run: composer install --no-dev - - name: Build plugin run: npm run build