From 839c5a5dbc6a31509405bdf014ddb2d727d3b28e Mon Sep 17 00:00:00 2001 From: Oscar Arzola Date: Tue, 21 May 2024 17:31:59 -0400 Subject: [PATCH 1/3] fix: dependabot and ci updates --- .github/dependabot.yml | 47 +++++---- .github/workflows/build-and-lint.yml | 12 --- .github/workflows/create-release.yml | 11 +++ .github/workflows/ensure-npm-build.yml | 10 ++ .github/workflows/standards-and-test.yml | 112 ---------------------- .github/workflows/tests.yml | 31 ++++++ .github/workflows/update-mo.yml | 8 +- .github/workflows/update-pot.yml | 48 +++------- .github/workflows/update-translations.yml | 44 --------- .nvmrc | 2 +- .release-please-manifest.json | 3 + README.md | 39 +------- release-please-config.json | 11 +++ 13 files changed, 118 insertions(+), 260 deletions(-) delete mode 100644 .github/workflows/build-and-lint.yml create mode 100644 .github/workflows/create-release.yml create mode 100644 .github/workflows/ensure-npm-build.yml delete mode 100644 .github/workflows/standards-and-test.yml create mode 100644 .github/workflows/tests.yml delete mode 100644 .github/workflows/update-translations.yml create mode 100644 .release-please-manifest.json create mode 100644 release-please-config.json diff --git a/.github/dependabot.yml b/.github/dependabot.yml index c62eb3c..51c56a8 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,35 +1,48 @@ version: 2 updates: - # Maintain dependencies for npm - - package-ecosystem: "npm" - # Look for `package.json` and `package-lock.json` files in the root directory + # Maintain dependencies for Composer + - package-ecosystem: "composer" directory: "/" - # Check for updates weekly schedule: interval: "weekly" allow: - # Allow direct updates only (for packages named in package.json) - dependency-type: "direct" - # Allow up to 10 open pull requests for npm dependencies - open-pull-requests-limit: 10 + open-pull-requests-limit: 5 + versioning-strategy: "increase-if-necessary" + ignore: + - dependency-name: "*" + update-types: [ "version-update:semver-major" ] + groups: + composer-dependencies: + dependency-type: "production" + composer-dev-dependencies: + dependency-type: "development" - # Maintain dependencies for Composer - - package-ecosystem: "composer" - # Look for `composer.json` and `composer.lock` files in the root directory + # Maintain dependencies for npm + - package-ecosystem: "npm" directory: "/" - # Check for updates weekly schedule: interval: "weekly" allow: - # Allow direct updates only (for packages named in composer.json) - dependency-type: "direct" - # Allow up to 10 open pull requests for composer dependencies - open-pull-requests-limit: 10 + open-pull-requests-limit: 5 + versioning-strategy: "increase-if-necessary" + ignore: + - dependency-name: "*" + update-types: [ "version-update:semver-major" ] + groups: + npm-dependencies: + dependency-type: "production" + npm-dev-dependencies: + dependency-type: "development" + # Maintain dependencies for GitHub Actions - package-ecosystem: "github-actions" directory: "/" schedule: interval: "weekly" - allow: - - dependency-type: "direct" - open-pull-requests-limit: 10 + open-pull-requests-limit: 5 + groups: + all-github-actions: + patterns: + - ".*" diff --git a/.github/workflows/build-and-lint.yml b/.github/workflows/build-and-lint.yml deleted file mode 100644 index a7a3849..0000000 --- a/.github/workflows/build-and-lint.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: Build & Lint -on: - push: - branches: [ dev, production ] - tags: - - '*.*.*' - pull_request: - branches: [ dev ] - -jobs: - build: - uses: pressbooks/composer-autoupdate-bedrock/.github/workflows/lint-build.yml@v2 diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml new file mode 100644 index 0000000..ed54dea --- /dev/null +++ b/.github/workflows/create-release.yml @@ -0,0 +1,11 @@ +name: Prepare Release ๐Ÿš€ + +on: + push: + branches: + - dev + +jobs: + deploy: + uses: pressbooks/reusable-workflows/.github/workflows/prepare-release.yml@main + secrets: inherit diff --git a/.github/workflows/ensure-npm-build.yml b/.github/workflows/ensure-npm-build.yml new file mode 100644 index 0000000..bf1cc3c --- /dev/null +++ b/.github/workflows/ensure-npm-build.yml @@ -0,0 +1,10 @@ +name: Npm build โš™๏ธ + +on: + pull_request: + branches: [ dev ] + +jobs: + update-npm-build: + if: ${{ github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' }} + uses: pressbooks/reusable-workflows/.github/workflows/npm-build.yml@main diff --git a/.github/workflows/standards-and-test.yml b/.github/workflows/standards-and-test.yml deleted file mode 100644 index 995a5bb..0000000 --- a/.github/workflows/standards-and-test.yml +++ /dev/null @@ -1,112 +0,0 @@ -name: Standards & Test -on: - push: - branches: [ dev, production ] - tags: - - '*.*.*' - pull_request: - branches: [ dev ] - -jobs: - phpunit: - runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.experimental }} - strategy: - fail-fast: false - matrix: - php: [8.1, 8.2] - os: [ubuntu-20.04] - wordpress: ['6.5', latest] - include: - - experimental: true - - experimental: false - php: 8.1 - wordpress: '6.5' - - name: PHPUnit - ${{ matrix.php }} - WP ${{ matrix.wordpress }} - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Start required services - run: sudo systemctl start mysql.service - - - name: Cache Composer packages - uses: actions/cache@v4 - with: - path: vendor - key: ${{ matrix.php }}-php-${{ hashFiles('**/composer.lock') }} - - - name: Setup PHP with Composer 2 - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - tools: composer - coverage: pcov - - - name: Install PHP dependencies - run: | - export PATH="$HOME/.composer/vendor/bin:$PATH" - composer install --no-interaction - git clone --depth=1 https://github.com/pressbooks/pressbooks.git ../pressbooks - cd ../pressbooks && composer install --no-dev - cd ../pressbooks-cas-sso - - - name: Run PHP CodeSniffer - run: composer standards - - - name: Install WP tests - run: bash bin/install-wp-tests.sh wordpress_test root root localhost ${{ matrix.wordpress }} - - - name: Run PHP Tests - run: composer test - if: matrix.experimental == true - - - name: Run PHP Tests and PCOV - run: composer test-coverage - if: matrix.experimental == false - - - name: Upload Coverage to Codecov - run: bash <(curl -s https://codecov.io/bash) - if: matrix.experimental == false - - - name: Prepare Build - if: startsWith(github.ref, 'refs/tags/') - run: | - export COMPOSER_MEMORY_LIMIT=-1 - export GITHUB_BUILD_PATH=${{github.workspace}} - export GITHUB_REPO_SLUG="$(basename ${{github.workspace}})" - export GITHUB_TAG="$(basename ${{github.ref}})" - echo "File to be created : $GITHUB_BUILD_PATH/$GITHUB_REPO_SLUG-$GITHUB_TAG.zip" - curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar - chmod +x wp-cli.phar - mv wp-cli.phar /usr/local/bin/wp - wp package install wp-cli/dist-archive-command - npm install - npm run build - composer install --no-dev --optimize-autoloader - cd .. - wp dist-archive $GITHUB_REPO_SLUG $GITHUB_BUILD_PATH/$GITHUB_REPO_SLUG-$GITHUB_TAG.zip - cd $GITHUB_BUILD_PATH - ls $GITHUB_BUILD_PATH - - - name: Deploy - if: startsWith(github.ref, 'refs/tags/') - uses: softprops/action-gh-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - files: - ${{github.workspace}}/*.zip - - - name: Trigger Bedrock Update - if: (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/production') && matrix.experimental == false - uses: pressbooks/composer-autoupdate-bedrock@main - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_SNS_ARN_DEV: ${{ secrets.AWS_SNS_ARN_DEV }} - AWS_SNS_ARN_STAGING: ${{ secrets.AWS_SNS_ARN_STAGING }} - INPUT_TRIGGERED_BY: ${{ github.repository }} - BRANCH: ${{ github.ref }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..b685470 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,31 @@ +name: Run Tests ๐Ÿงช + +on: + push: + branches: + - dev + pull_request: + branches: + - dev + workflow_dispatch: + +jobs: + plugin-tests: + uses: pressbooks/reusable-workflows/.github/workflows/pb-plugin-tests.yml@main + secrets: inherit + with: + requires_pressbooks: true + trigger_bedrock_updates: + needs: plugin-tests + runs-on: ubuntu-latest + steps: + - name: Trigger Bedrock Updates + if: github.ref == 'refs/heads/dev' + uses: pressbooks/composer-autoupdate-bedrock@main + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_SNS_ARN_DEV: ${{ secrets.AWS_SNS_ARN_DEV }} + AWS_SNS_ARN_STAGING: ${{ secrets.AWS_SNS_ARN_STAGING }} + INPUT_TRIGGERED_BY: ${{ github.repository }} + REF: ${{ github.ref }} diff --git a/.github/workflows/update-mo.yml b/.github/workflows/update-mo.yml index 6205803..befb8e5 100644 --- a/.github/workflows/update-mo.yml +++ b/.github/workflows/update-mo.yml @@ -1,12 +1,12 @@ -name: Update .mo files +name: Update .mo files ๐ŸŒ on: pull_request: - branches: [ dev ] + branches: [dev] paths: - - 'languages/*.po' + - "languages/*.po" workflow_dispatch: jobs: update-mo-files: - uses: pressbooks/reusable-workflows/.github/workflows/update-mo.yml@dev + uses: pressbooks/reusable-workflows/.github/workflows/update-mo.yml@main diff --git a/.github/workflows/update-pot.yml b/.github/workflows/update-pot.yml index 3241f5c..2548b46 100644 --- a/.github/workflows/update-pot.yml +++ b/.github/workflows/update-pot.yml @@ -1,41 +1,19 @@ -name: Update POT file +name: Update .pot file ๐ŸŒ on: - push: - branches: - - dev + pull_request: + branches: [dev] paths: - - '**.php' - - '**.js' + - "**.php" + - "**.js" workflow_dispatch: jobs: - update-pot: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Setup PHP with tools - uses: shivammathur/setup-php@v2 - with: - php-version: '8.1' - tools: composer, wp-cli/wp-cli-bundle - - name: Update POT file - run: wp i18n make-pot . languages/pressbooks-cas-sso.pot --domain=pressbooks-cas-sso --slug=pressbooks-cas-sso --package-name="Pressbooks CAS Single Sign-On" --headers="{\"Report-Msgid-Bugs-To\":\"https://github.com/pressbooks/pressbooks-cas-sso/issues\"}" - - name: Create Pull Request for POT file - id: cprpot - uses: peter-evans/create-pull-request@v5 - with: - token: ${{ secrets.PAT_FOR_GITHUB_ACTIONS }} - labels: automerge-pot - commit-message: 'chore(l10n): update pot file' - title: 'chore(l10n): update pot file' - body: 'This pull request updates the POT file for this plugin.' - branch: chore/update-pot-file - - name: Merge pull request with updated POT file - if: ${{ steps.cprpot.outputs.pull-request-number }} - uses: "pascalgn/automerge-action@v0.16.2" - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - MERGE_LABELS: automerge-pot - MERGE_METHOD: squash - PULL_REQUEST: "${{ steps.cprpot.outputs.pull-request-number }}" + update-pot-file: + uses: pressbooks/reusable-workflows/.github/workflows/update-pot.yml@main + secrets: inherit + with: + domain: "pressbooks-cas-sso" + slug: "pressbooks-cas-sso" + package_name: "Pressbooks CAS SSO" + headers: '{"Report-Msgid-Bugs-To": "https://github.com/pressbooks/pressbooks-cas-sso/issues"}' diff --git a/.github/workflows/update-translations.yml b/.github/workflows/update-translations.yml deleted file mode 100644 index 365c547..0000000 --- a/.github/workflows/update-translations.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Update translations from Transifex - -on: workflow_dispatch - -jobs: - update-translations: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - token: ${{ secrets.PAT_FOR_GITHUB_ACTIONS }} - - name: Install Transifex Client - run: | - curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash - source ~/.bashrc - - name: Pull translations from Transifex - run: tx pull --all --force --minimum-perc=25 - env: - TX_TOKEN: ${{ secrets.TX_TOKEN }} - - name: Setup PHP with tools - uses: shivammathur/setup-php@v2 - with: - php-version: '8.1' - tools: composer, wp-cli/wp-cli-bundle - - name: Generate MO files - run: wp i18n make-mo languages - - name: Create Pull Request for MO files - id: cprtransifex - uses: peter-evans/create-pull-request@v5 - with: - token: ${{ secrets.PAT_FOR_GITHUB_ACTIONS }} - commit-message: 'chore(l10n): update languages/*.mo' - labels: automerge-mo - title: 'chore(l10n): update languages/*.mo' - body: 'This pull request updates the MO files for the latest changes in the POT file.' - branch: chore/update-mo-files - - name: Merge pull request with updated MO files - if: ${{ steps.cprtransifex.outputs.pull-request-number }} - uses: "pascalgn/automerge-action@v0.16.2" - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - MERGE_LABELS: automerge-mo - MERGE_METHOD: squash - PULL_REQUEST: "${{ steps.cprtransifex.outputs.pull-request-number }}" diff --git a/.nvmrc b/.nvmrc index 3f430af..9a2a0e2 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v18 +v20 diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..a549f59 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "2.4.0" +} diff --git a/README.md b/README.md index a2765b8..5eac0b0 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,9 @@ Contributors: conner_bw, greatislander Tags: pressbooks, sso, cas Requires at least: 6.5 Tested up to: 6.5 + Stable tag: 2.4.0 + License: GPLv3 or later License URI: https://www.gnu.org/licenses/gpl-3.0.html @@ -49,38 +51,5 @@ Because this plugin uses the fabulous [apereo/phpCAS](https://github.com/apereo/ ![Pressbooks CAS Administration.](screenshot-1.png) -## Changelog -### 2.4.0 - -* See: https://github.com/pressbooks/pressbooks-cas-sso/releases/tag/2.4.0 -* Full release history available at: https://github.com/pressbooks/pressbooks-cas-sso/releases - -### 2.3.2 - -* See: https://github.com/pressbooks/pressbooks-cas-sso/releases/tag/2.3.2 -* Full release history available at: https://github.com/pressbooks/pressbooks-cas-sso/releases - -## Upgrade Notices -### 2.3.2 -* Pressbooks CAS Single Sign-On requires WordPress >= 6.4.3 - -### 2.3.1 -* Pressbooks CAS Single Sign-On requires WordPress >= 6.3.2 - -### 2.3.0 -* Pressbooks CAS Single Sign-On requires PHP >= 8.1 -* Pressbooks CAS Single Sign-On requires Pressbooks >= 6.9.0 - -### 2.2.0 -* Pressbooks CAS Single Sign-On requires PHP >= 8.0 -* Pressbooks CAS Single Sign-On requires WordPress >= 6.1.1 -* Pressbooks CAS Single Sign-On requires Pressbooks >= 6.4.0 - -### 2.0.0 -* Pressbooks CAS Single Sign-On requires Pressbooks >= 6.0.0 - -### 1.2.4 -* Pressbooks CAS Single Sign-On requires Pressbooks >= 5.34.1 - -### 1.2.3 -* Pressbooks CAS Single Sign-On requires Pressbooks >= 5.9.1 +### Changelog +Please see the [CHANGELOG](CHANGELOG.md) file for more information. diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..8bca7de --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "release-type": "simple", + "include-component-in-tag": false, + "include-v-in-tag": false, + "packages": { + ".": { + "extra-files": ["pressbooks-cas-sso.php", "README.md"] + } + } +} From 0d726bdc598924eedf584189069b409893dd2797 Mon Sep 17 00:00:00 2001 From: Oscar Arzola Date: Wed, 22 May 2024 22:08:55 -0400 Subject: [PATCH 2/3] ci: update ensure-npm-build.yml --- .github/workflows/ensure-npm-build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ensure-npm-build.yml b/.github/workflows/ensure-npm-build.yml index bf1cc3c..06563e3 100644 --- a/.github/workflows/ensure-npm-build.yml +++ b/.github/workflows/ensure-npm-build.yml @@ -2,7 +2,9 @@ name: Npm build โš™๏ธ on: pull_request: - branches: [ dev ] + branches: [dev] + paths: + - "src/assets/**/*" jobs: update-npm-build: From cb8112db9fe6e00fc753c19346c07826c75659ca Mon Sep 17 00:00:00 2001 From: Oscar Arzola Date: Wed, 22 May 2024 22:26:49 -0400 Subject: [PATCH 3/3] Update ensure-npm-build.yml --- .github/workflows/ensure-npm-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ensure-npm-build.yml b/.github/workflows/ensure-npm-build.yml index 06563e3..1532d92 100644 --- a/.github/workflows/ensure-npm-build.yml +++ b/.github/workflows/ensure-npm-build.yml @@ -4,7 +4,7 @@ on: pull_request: branches: [dev] paths: - - "src/assets/**/*" + - "assets/**/*" jobs: update-npm-build: