Skip to content

chore(release): 2.10.1-816A5A.0 #131

chore(release): 2.10.1-816A5A.0

chore(release): 2.10.1-816A5A.0 #131

Workflow file for this run

name: Release Beta Build
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+-*.[0-9]+"
jobs:
set-variables:
name: Set Variables
runs-on: ubuntu-latest
timeout-minutes: 2
outputs:
node-version: ${{ steps.nvm.outputs.NVMRC }}
php-version: ${{ steps.php.outputs.PHP_VERSION }}
build-number: ${{ steps.build-number.outputs.BUILD_NUMBER }}
steps:
- uses: actions/checkout@v4
- name: Get node version
run: echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_OUTPUT
id: nvm
- name: Get PHP cersion
run: echo "PHP_VERSION=7.4" >> $GITHUB_OUTPUT
id: php
- name: Set Build Number
run: echo "BUILD_NUMBER=$(cat package.json | jq -r '.version')" >> $GITHUB_OUTPUT
id: build-number
install-dependencies:
name: Cache Dependencies
runs-on: ubuntu-latest
timeout-minutes: 20
needs: set-variables
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set node version
uses: actions/setup-node@v4
with:
node-version: ${{ needs.set-variables.outputs.node-version }}
- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: ${{ needs.set-variables.outputs.php-version }}
- name: Install Node dependencies
run: npm ci
- name: Install Composer dependencies
run: composer install
- name: Save to Cache
uses: actions/cache@v4
with:
save-always: true
path: |
vendor
node_modules
key: dependencies-${{ runner.os }}-${{ github.sha }}
linting:
name: Linting
runs-on: ubuntu-latest
timeout-minutes: 20
needs:
- install-dependencies
- set-variables
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set node version
uses: actions/setup-node@v4
with:
node-version: ${{ needs.set-variables.outputs.node-version }}
- name: Pull dependencies from cache
uses: actions/cache@v4
with:
fail-on-cache-miss: true
path: |
vendor
node_modules
key: dependencies-${{ runner.os }}-${{ github.sha }}
- name: Lint JavaScript source code
run: npm run lint
- name: Lint PHP source code
run: composer lint
testing:
name: Testing
runs-on: ubuntu-latest
timeout-minutes: 20
needs:
- install-dependencies
- set-variables
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set node version
uses: actions/setup-node@v4
with:
node-version: ${{ needs.set-variables.outputs.node-version }}
- name: Pull dependencies from cache
uses: actions/cache@v4
with:
fail-on-cache-miss: true
path: |
vendor
node_modules
key: dependencies-${{ runner.os }}-${{ github.sha }}
- name: Test JavaScript source code
run: npm test
build:
name: Build Artifact
runs-on: ubuntu-latest
needs:
- install-dependencies
- set-variables
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Pull dependencies from cache
uses: actions/cache@v4
with:
fail-on-cache-miss: true
path: |
vendor
node_modules
key: dependencies-${{ runner.os }}-${{ github.sha }}
- name: Set node version
uses: actions/setup-node@v4
with:
node-version: ${{ needs.set-variables.outputs.node-version }}
- name: Build JavaScript artifact
run: npm run build
- name: Create release notes
run: npm run createWpReadme
- name: Prune Composer dependencies
run: composer install --no-dev --no-scripts
- name: Prune JavaScript dependencies
run: npm prune --production
- name: Find files not included in distignore
id: dist-files
run: echo "DIST_FILES=$(find . -type f | grep -v -E -f .distignore | tr '\n' ' ')" >> $GITHUB_OUTPUT
- name: Build plugin artifact
uses: vimtor/action-zip@v1.2
with:
files: ${{ steps.dist-files.outputs.DIST_FILES }}
recursive: false
dest: ./Force-Refresh-${{ needs.set-variables.outputs.build-number }}.zip
- name: Save build to cache
uses: actions/cache@v4
with:
save-always: true
path: '**/'
key: build-${{ runner.os }}-${{ github.sha }}
release:
name: Release Beta
runs-on: ubuntu-latest
needs:
- set-variables
- install-dependencies
- linting
- testing
- build
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get commits since last release
id: changes
uses: simbo/changes-between-tags-action@v1
with:
validate-tag: false
tag-pattern: '^v[0-9]+\.[0-9]+\.[0-9]+-.*\.[0-9]+$'
include-tag-commit: false
- name: Pull build from cache
uses: actions/cache@v4
with:
path: '**/'
key: build-${{ runner.os }}-${{ github.sha }}
- name: Create GitHub release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./Force-Refresh-${{ needs.set-variables.outputs.build-number }}.zip
asset_name: Force_Refresh_v${{ needs.set-variables.outputs.build-number }}.zip
tag: ${{ github.ref }}
release_name: Force Refresh ${{ needs.set-variables.outputs.build-number }}
overwrite: true
prerelease: true
body: "This is a beta release of Force Refresh (v${{ needs.set-variables.outputs.build-number }}).
This release is intended to be used for debugging and **should not** be used on production sites unless directed.
Production-stable versions are available at https://wordpress.org/plugins/force-refresh. \n\n##
Changelog Since Last Release\n\n${{ steps.changes.outputs.changes || 'Performance enhancements and bug fixes' }}"
- name: Comment on PR
uses: mshick/add-pr-comment@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
message: Build ${{ needs.set-variables.outputs.build-number }} is available for download at [Releases](https://github.com/jordanleven/force-refresh/releases/tag/v${{ needs.set-variables.outputs.build-number }}).
allow-repeats: true
- name: Simulate deploy to WordPress.org
uses: 10up/action-wordpress-plugin-deploy@stable
with:
dry-run: true
env:
ASSETS_DIR: .wordpress-org
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SLUG: force-refresh