Pin all floating version tags (@v1, @v2, @v3, @v4, @master) to full commit SHAs across all workflow files to eliminate supply chain security risk. Actions pinned: - actions/checkout@v3 -> f43a0e5 (v3.6.0) in release.yml, sync-wiki.yml - actions/checkout@v4 -> 34e1148 (v4) in tests.yml - shivammathur/setup-php@v2 -> accd612 (v2) in all workflows - actions/setup-node@v4 -> 49933ea (v4) in playground-tests*.yml, wordpress-tests.yml - actions/upload-artifact@v4 -> ea165f8 (v4) in playground-tests*.yml, wordpress-tests.yml - softprops/action-gh-release@v1 -> de2c0eb (v1) in release.yml - codacy/codacy-analysis-cli-action@v4 -> 562ee3e (v4) in code-quality.yml - github/codeql-action/upload-sarif@v3 -> 603b797 (v3) in code-quality.yml - swissspidy/wp-performance-action@v2.0.3 -> b7e3ffc (v2.0.3) in playground-tests.yml - SonarSource/sonarqube-scan-action@master -> 9598b8a in sonarcloud.yml Closes #89
79 lines
3.1 KiB
YAML
79 lines
3.1 KiB
YAML
name: Release - Build and publish plugin releases
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
- 'v*-stable'
|
|
|
|
jobs:
|
|
build:
|
|
name: Build and Release
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2
|
|
with:
|
|
php-version: '7.4'
|
|
extensions: mbstring, intl, zip
|
|
tools: composer:v2
|
|
|
|
- name: Get tag name
|
|
id: get_tag
|
|
run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
|
|
|
- name: Extract version from tag
|
|
id: get_version
|
|
run: |
|
|
VERSION=$(echo ${{ env.TAG }} | sed 's/^v//' | sed 's/-stable$//')
|
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
|
|
|
- name: Install dependencies
|
|
run: composer install --no-dev --optimize-autoloader
|
|
|
|
- name: Create build directory
|
|
run: |
|
|
mkdir -p build/wp-plugin-starter-template-for-ai-coding
|
|
cp -R *.php README.md LICENSE CHANGELOG.md readme.txt composer.json build/wp-plugin-starter-template-for-ai-coding/
|
|
cp -R admin includes languages vendor build/wp-plugin-starter-template-for-ai-coding/
|
|
mkdir -p build/wp-plugin-starter-template-for-ai-coding/assets/banner build/wp-plugin-starter-template-for-ai-coding/assets/icon build/wp-plugin-starter-template-for-ai-coding/assets/screenshots
|
|
if [ -d "assets/banner" ]; then cp -R assets/banner/* build/wp-plugin-starter-template-for-ai-coding/assets/banner/; fi
|
|
if [ -d "assets/icon" ]; then cp -R assets/icon/* build/wp-plugin-starter-template-for-ai-coding/assets/icon/; fi
|
|
if [ -d "assets/screenshots" ]; then cp -R assets/screenshots/* build/wp-plugin-starter-template-for-ai-coding/assets/screenshots/; fi
|
|
|
|
- name: Create ZIP file
|
|
run: |
|
|
cd build
|
|
zip -r ../wp-plugin-starter-template-for-ai-coding-${{ env.VERSION }}.zip wp-plugin-starter-template-for-ai-coding -x "*.DS_Store" -x "*.git*"
|
|
cd ..
|
|
|
|
- name: Extract changelog
|
|
id: extract_changelog
|
|
run: |
|
|
CHANGELOG=$(grep -A 20 "#### \[${{ env.VERSION }}\]" CHANGELOG.md | sed -n '/####/,/####/p' | sed '$d')
|
|
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
|
|
echo "$CHANGELOG" >> $GITHUB_ENV
|
|
echo "EOF" >> $GITHUB_ENV
|
|
|
|
- name: Create Release
|
|
id: create_release
|
|
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
|
|
with:
|
|
files: wp-plugin-starter-template-for-ai-coding-${{ env.VERSION }}.zip
|
|
name: v${{ env.VERSION }} - WordPress Plugin Starter Template
|
|
draft: false
|
|
prerelease: false
|
|
body: |
|
|
# WordPress Plugin Starter Template v${{ env.VERSION }}
|
|
|
|
${{ env.CHANGELOG }}
|
|
|
|
[View full changelog](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/blob/main/CHANGELOG.md)
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|