Release Beta Build #111
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release Beta Build | |
on: | |
push: | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+-*.[0-9]+" | |
jobs: | |
set-meta-data: | |
name: Set Meta Data | |
runs-on: ubuntu-latest | |
timeout-minutes: 2 | |
outputs: | |
node-version: ${{ steps.nvm.outputs.NVMRC }} | |
release-version: ${{ steps.release-version.outputs.RELEASE_VERSION }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Read .nvmrc | |
run: echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_OUTPUT | |
id: nvm | |
- name: Set Release Version | |
run: echo "RELEASE_VERSION=$(cat package.json | jq -r '.version')" >> $GITHUB_OUTPUT | |
id: release-version | |
install-dependencies: | |
name: Cache Dependencies | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
needs: set-meta-data | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set node version | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ needs.set-meta-data.outputs.node-version }} | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 7.4 | |
- name: Install Node dependencies | |
run: npm ci | |
- name: Install Composer dependencies | |
run: composer install | |
- name: Save to Cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
vendor | |
node_modules | |
key: dependencies-${{ runner.os }}-${{ github.sha }} | |
linting: | |
name: Linting | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
needs: | |
- install-dependencies | |
- set-meta-data | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set node version | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ needs.set-meta-data.outputs.node-version }} | |
- name: Pull dependencies from cache | |
uses: actions/cache@v4 | |
with: | |
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-meta-data | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set node version | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ needs.set-meta-data.outputs.node-version }} | |
- name: Pull dependencies from cache | |
uses: actions/cache@v4 | |
with: | |
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-meta-data | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Pull dependencies from cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
vendor | |
node_modules | |
key: dependencies-${{ runner.os }}-${{ github.sha }} | |
- name: Set node version | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ needs.set-meta-data.outputs.node-version }} | |
- name: Create release notes | |
run: npm run createWpReadme | |
- name: Build JavaScript artifact | |
run: npm run build | |
- name: Build PHP artifact | |
run: composer build ./ ./Force-Refresh-${{ needs.set-meta-data.outputs.release-version }}.zip | |
- name: Prune JavaScript dependencies | |
run: npm prune --production | |
- name: Prune PHP dependencies | |
run: composer install --no-dev --no-scripts | |
- 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-meta-data | |
- 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-meta-data.outputs.release-version }}.zip | |
asset_name: Force_Refresh_v${{ needs.set-meta-data.outputs.release-version }}.zip | |
tag: ${{ github.ref }} | |
release_name: Force Refresh ${{ needs.set-meta-data.outputs.release-version }} | |
overwrite: true | |
prerelease: true | |
body: "This is a beta release of Force Refresh (v${{ needs.set-meta-data.outputs.release-version }}). | |
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' }}" |