diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 604a1f87..51c56a81 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,27 +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" + open-pull-requests-limit: 5 + groups: + all-github-actions: + patterns: + - ".*" diff --git a/.github/workflows/check-standards.yml b/.github/workflows/check-standards.yml deleted file mode 100644 index 19f75bd5..00000000 --- a/.github/workflows/check-standards.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Check Standards - -on: - push: - branches: [dev, production] - tags: - - '*.*.*' - pull_request: - branches: [dev, production] - -jobs: - src: - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: true - matrix: - php: [8.1] - os: [ubuntu-20.04] - - name: Source code on PHP ${{ matrix.php }} - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Cache composer packages - uses: actions/cache@v3 - with: - path: vendor - key: ${{ matrix.php }}-php-${{ hashFiles('**/composer.lock') }} - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - tools: composer - coverage: none - - - name: Install dependencies - run: | - export PATH="$HOME/.composer/vendor/bin:$PATH" - composer install --prefer-dist --no-interaction --no-progress - - - name: Execute style checking - run: composer standards diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml new file mode 100644 index 00000000..ed54dea7 --- /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 00000000..bf1cc3ca --- /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/run-tests.yml b/.github/workflows/run-tests.yml deleted file mode 100644 index 9163e0cd..00000000 --- a/.github/workflows/run-tests.yml +++ /dev/null @@ -1,149 +0,0 @@ -name: Tests - -on: - push: - branches: [dev, production] - tags: - - '*.*.*' - pull_request: - branches: [dev, production] - -jobs: - tests: - 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: Tests - PHP ${{ matrix.php }} - WP ${{ matrix.wordpress }} - - outputs: - coverage: ${{ matrix.experimental == false }} - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Remove MySQL - run: sudo apt remove mysql-server-8.0 mysql-common - - - name: Update apt - run: sudo apt-get update - - - name: Install MariaDB - run: | - sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 - echo "deb http://downloads.mariadb.com/MariaDB/mariadb-10.5/repo/ubuntu focal main" | sudo tee /etc/apt/sources.list.d/mariadb.list - sudo apt-get update -o Dir::Etc::sourcelist="sources.list.d/mariadb.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" - sudo apt-get install mariadb-server-10.5 mariadb-client-10.5 - sudo mysqladmin -p'' password 'root' - - - name: Start required services - run: sudo systemctl start mysql && mysql --version - - - name: Cache composer packages - uses: actions/cache@v3 - with: - path: vendor - key: ${{ matrix.php }}-php-${{ hashFiles('**/composer.lock') }} - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - tools: composer - coverage: pcov - - - name: Install PHP dependencies - run: | - composer install --no-interaction --no-progress - git clone --depth=1 https://github.com/pressbooks/pressbooks.git ../pressbooks - cd ../pressbooks && composer install --no-dev - cd ../pressbooks-multi-institution - - - name: Install WP tests - run: bash bin/install-wp-tests.sh wordpress_test root root localhost ${{ matrix.wordpress }} - - - name: Run tests - run: composer test - if: matrix.experimental == true - - - name: Run tests with coverage - run: composer test-coverage - if: matrix.experimental == false - - - name: Save code coverage to artifact - uses: actions/upload-artifact@v4 - if: matrix.experimental == false - with: - name: code-coverage - path: "coverage.xml" - retention-days: 5 - overwrite: true - - - name: Prepare Build - if: startsWith(github.ref, 'refs/tags/') && matrix.experimental == false - 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/') && matrix.experimental == false - uses: softprops/action-gh-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.PAT_FOR_GITHUB_ACTIONS }} - 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 }} - INPUT_BRANCH: ${{ github.ref }} - - coverage: - runs-on: ubuntu-latest - needs: - - tests - name: Upload coverage - if: needs.tests.outputs.coverage - steps: - - uses: actions/checkout@v4 - - name: Fetch code coverage artifact - uses: actions/download-artifact@v4 - with: - name: code-coverage - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} - slug: pressbooks/pressbooks-multi-institution diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..db2da07f --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,32 @@ +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 + use_mariadb: 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 6205803c..befb8e54 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 d86622e8..cfbfbb18 100644 --- a/.github/workflows/update-pot.yml +++ b/.github/workflows/update-pot.yml @@ -1,43 +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 - with: - token: ${{ secrets.PAT_FOR_GITHUB_ACTIONS }} - - 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-multi-institution.pot --domain=pressbooks-multi-institution --slug=pressbooks-multi-institution --package-name="Pressbooks Multi Institution" --headers="{\"Report-Msgid-Bugs-To\":\"https://github.com/pressbooks/pressbooks-multi-institution/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-multi-institution" + slug: "pressbooks-multi-institution" + package_name: "Pressbooks Shared Network" + headers: '{"Report-Msgid-Bugs-To": "https://github.com/pressbooks/pressbooks-multi-institution/issues"}' diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..9a2a0e21 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v20 diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 00000000..466df71c --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.1.0" +} diff --git a/README.md b/README.md index 55c8a2aa..f5d3b0f4 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,9 @@ **Tags:** pressbooks, plugin \ **Requires at least:** 6.4.3 \ **Tested up to:** 6.4.3 \ + **Stable tag:** 0.1.0 \ + **License:** GPLv3 or later \ **License URI:** https://www.gnu.org/licenses/gpl-3.0.html @@ -53,8 +55,5 @@ Blade templates are located in the `resources/views/{namespace}` directory. Models are located in the `src/Models` directory. -## Changelog - -### 0.1.0 -* See: https://github.com/pressbooks/pressbooks-multi-institution/releases/tag/0.1.0 -* Full release history available at: https://github.com/pressbooks/pressbooks-multi-institution/releases +### Changelog +Please see the [CHANGELOG](CHANGELOG.md) file for more information. diff --git a/pressbooks-multi-institution.php b/pressbooks-multi-institution.php index 6cfac466..e762d35e 100644 --- a/pressbooks-multi-institution.php +++ b/pressbooks-multi-institution.php @@ -6,7 +6,9 @@ * Requires at least: 6.5 * Requires Plugins: pressbooks * Description: Tools for managing Pressbooks networks shared by multiple institutions + * x-release-please-start-version * Version: 0.1.0 + * x-release-please-end * Author: Pressbooks (Book Oven Inc.) * Author URI: https://pressbooks.org * Requires PHP: 8.1 diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 00000000..72b42df6 --- /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-multi-institution.php", "README.md"] + } + } +}