Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GH Actions #412

Merged
merged 20 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/build-and-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Build and Tag

env:
NODE_VERSION: "20"
NODE_CACHE: "${{ github.workspace }}/node_modules_cache"

on:
push:
branches:
- 'master'

jobs:
wordpress:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: :php-psr
coverage: none

- name: composer install
run: composer install

- name: Set standard 10up cache directories
run: |
sudo npm config set cache "${{ env.NODE_CACHE }}" --global
- name: Prepare npm cache
uses: actions/cache@v4
with:
path: ${{ env.NODE_CACHE }}
key: npm-${{ env.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
npm-${{ env.NODE_VERSION }}-
- name: "Install node v${{ env.NODE_VERSION }}"
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- name: Build
run: |
npm ci
npm run build
- name: Setup
run: 'echo "VERSION=$(grep -Po ''\"version\": \"[0-9\\.]+\"'' package.json | grep -Po ''[0-9\\.]+'')" >> $GITHUB_ENV'

- name: Tag
run: |
echo "Releasing version $VERSION ..."
git config user.name github-actions
git config user.email github-actions@github.com
git checkout -b "release-$VERSION"
git add -f dist/*
git commit --no-verify -m "Release $VERSION"
git tag "$VERSION"
git push --tags
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
63 changes: 63 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Build

env:
NODE_VERSION: "20"
NODE_CACHE: "${{ github.workspace }}/node_modules_cache"

on:
pull_request:
branches:
- develop
- '[0-9].[0-9x]*' # Version branches: 4.x.x, 4.1.x, 5.x
- code-improvement # todo remove before merging into develop

jobs:
wordpress:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: :php-psr
coverage: none

- name: composer install
run: composer install

- name: Set standard 10up cache directories
run: |
sudo npm config set cache "${{ env.NODE_CACHE }}" --global

- name: Prepare npm cache
uses: actions/cache@v4
with:
path: ${{ env.NODE_CACHE }}
key: npm-${{ env.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
npm-${{ env.NODE_VERSION }}-

- name: "Install node v${{ env.NODE_VERSION }}"
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- name: Build
run: |
npm ci
npm run build

- name: Zip
run: npm run build:zip

- name: Make artifacts available
uses: actions/upload-artifact@v4
with:
name: Plugin Zip
retention-days: 2
path: |
${{ github.workspace }}/brightcove-video-connect.zip
30 changes: 26 additions & 4 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: E2E test

env:
NODE_VERSION: "18"
NODE_VERSION: "20"
NODE_CACHE: "${{ github.workspace }}/node_modules_cache"

on:
push:
Expand All @@ -11,6 +12,7 @@ on:
pull_request:
branches:
- develop
- code-improvement # todo remove before merging into develop
jobs:
cypress:
name: ${{ matrix.core.name }}
Expand All @@ -19,25 +21,45 @@ jobs:
matrix:
core:
- {name: 'WP latest', version: 'latest'}

steps:
- name: Install node
uses: actions/setup-node@v3
- name: Set standard 10up cache directories
run: |
sudo npm config set cache "${{ env.NODE_CACHE }}" --global

- name: Prepare npm cache
uses: actions/cache@v4
with:
path: ${{ env.NODE_CACHE }}
key: npm-${{ env.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
npm-${{ env.NODE_VERSION }}-

- name: "Install node v${{ env.NODE_VERSION }}"
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install dependencies
run: npm ci

- name: Composer (optional)
run: composer install
continue-on-error: true

- name: Build (optional)
run: npm run build
continue-on-error: true

- name: Set the core version
run: ./tests/bin/set-core-version.js ${{ matrix.core.version }}

- name: Set up WP environment
run: npm run env:start

- name: Test
run: npm run cypress:run
env:
Expand Down
42 changes: 32 additions & 10 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Linting

env:
NODE_VERSION: "20"
NODE_CACHE: "${{ github.workspace }}/node_modules_cache"

on:
push:
branches:
Expand All @@ -8,20 +12,37 @@ on:
pull_request:
branches:
- develop
- '[0-9].[0-9x]*' # Version branches: 4.x.x, 4.1.x, 5.x
- code-improvement # todo remove before merging into develop

jobs:
eslint:
name: eslint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: install node v16
uses: actions/setup-node@v2
- uses: actions/checkout@v4

- name: Set standard 10up cache directories
run: |
sudo npm config set cache "${{ env.NODE_CACHE }}" --global

- name: Prepare npm cache
uses: actions/cache@v4
with:
node-version: 16
- name: npm install
run: npm install
- name: eslint
path: ${{ env.NODE_CACHE }}
key: npm-${{ env.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
npm-${{ env.NODE_VERSION }}-

- name: "install node v${{ env.NODE_VERSION }}"
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- name: npm ci
run: npm ci

- name: es lint
run: npm run lint-js

phpcs:
Expand All @@ -30,16 +51,17 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: '8.3'
coverage: none
tools: cs2pr

- name: composer install
run: composer install

- name: PHPCS check
run: composer run lint
run: './vendor/bin/phpcs . -q --report=checkstyle --warning-severity=6 --runtime-set testVersion 5.6- | cs2pr'
50 changes: 0 additions & 50 deletions .github/workflows/php-compatibility.yml

This file was deleted.

5 changes: 3 additions & 2 deletions .github/workflows/push-asset-readme-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ jobs:
name: Push to master
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4
- name: WordPress.org plugin asset/readme update
uses: 10up/action-wordpress-plugin-asset-update@master
uses: 10up/action-wordpress-plugin-asset-update@stable
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SLUG: brightcove-video-connect
25 changes: 17 additions & 8 deletions .github/workflows/push-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
name: Deploy to WordPress.org
name: Publish New Release

env:
SLUG: "brightcove-video-connect"

on:
push:
tags:
- "*"
release:
types: [published]

jobs:
tag:
name: New tag
name: New release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Checkout code
uses: actions/checkout@v4

- name: WordPress Plugin Deploy
uses: 10up/action-wordpress-plugin-deploy@master
if: "! github.event.release.prerelease"
id: deploy
uses: 10up/action-wordpress-plugin-deploy@stable
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SLUG: ${{ env.SLUG }}
6 changes: 5 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ The `develop` branch is the development branch which means it contains the next
1. Commit your changes and open a PR to `develop`.
1. Once changes are merged, open a PR from `develop` to `master`.
1. Test: Once changes are merged, checkout the `master` branch locally and test for functionality.
1. Release: Once merged, draft a [new release](https://github.com/10up/brightcove-video-connect/releases/new) naming the release with the new version number, creating a new label `X.Y.Z`, and selecting as target `master`. Paste the release 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/brightcove-video-connect/#?closed=1).
1. [Check the _Build and Tag_ action](https://github.com/10up/brightcove-video-connect/actions/workflows/build-and-tag.yml): a new tag named with the version number should've been created. It should contain all the built assets.
1. Release: Create a [new release](https://github.com/10up/brightcove-video-connect/releases/new):
* **Tag**: The tag created in the previous step
* **Release title**: `Version X.Y.Z`
* **Description**: Release changelog from `CHANGELOG.md` + `See: https://github.com/10up/brightcove-video-connect/milestone/#?closed=1`
1. SVN: Wait for the [GitHub Action](https://github.com/10up/brightcove-video-connect/actions/workflows/push-deploy.yml) 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.
1. Check WordPress.org: Ensure that the changes are live on https://wordpress.org/plugins/brightcove-video-connect/. This may take a few minutes.
1. Close milestone: Edit the [milestone](https://github.com/10up/brightcove-video-connect/milestone/#) with release date (in the `Due date (optional)` field) and link to GitHub release (in the `Description` field), then close the milestone.
Expand Down
Loading
Loading