Skip to content

Svelte and React templates, lazy pages fix, adminBar page prop and im… #11

Svelte and React templates, lazy pages fix, adminBar page prop and im…

Svelte and React templates, lazy pages fix, adminBar page prop and im… #11

Workflow file for this run

name: tag-release
on:
push:
branches:
- main
jobs:
# Perform a Dry Run on the tag action and get the proposed version
check_tag:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: Bump version and push tag
id: check_tag
uses: anothrNick/[email protected]
env:
WITH_V: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_BUMP: none
RELEASE_BRANCHES: main
DRY_RUN: true
outputs:
bump: ${{ steps.check_tag.outputs.part }}
new_tag: ${{ steps.check_tag.outputs.new_tag }}
# With the version from the last step, write it to the entry PHP file and create the changelog file
version:
runs-on: ubuntu-latest
needs: check_tag
if: needs.check_tag.outputs.bump != '' && needs.check_tag.outputs.bump != 'none'
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: Update version in PHP file
run: |
VERSION=${{ needs.check_tag.outputs.new_tag }}
VERSION=${VERSION#v}
sed -i "s/Version: .*/Version: $VERSION/" inertia-wordpress.php
- name: Process changelog
id: changelog_file
run: |
if [[ ! -z $(cat changelog/next.md) ]] ; then
echo "changelog=${{ needs.check_tag.outputs.new_tag }}-$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
mv changelog/next.md changelog/${{ needs.check_tag.outputs.new_tag }}-$(date +'%Y-%m-%d').md
touch changelog/next.md
else
echo "changelog=next" >> $GITHUB_OUTPUT
fi
- name: Commit changes to changelog folder
continue-on-error: true
run: |
git config --global user.email "[email protected]"
git config --global user.name "evoMark Action"
git add changelog/ inertia-wordpress.php
git commit -m "Chore: Updated changelog and version"
git push
outputs:
changelog: ${{ steps.changelog_file.outputs.changelog }}
# Actually create the git tag
tag:
runs-on: ubuntu-latest
needs:
- check_tag
- version
if: needs.check_tag.outputs.bump != '' && needs.check_tag.outputs.bump != 'none'
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: Fetch and checkout the latest commit
run: |
git fetch origin main
git checkout origin/main
- name: Bump version and push tag
id: tag
uses: anothrNick/[email protected]
env:
WITH_V: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_BUMP: none
RELEASE_BRANCHES: main
outputs:
bump: ${{ steps.tag.outputs.part }}
new_tag: ${{ steps.tag.outputs.new_tag }}
# Create a release with asset
release:
runs-on: ubuntu-latest
permissions:
contents: write
needs:
- tag
- version
if: needs.tag.outputs.bump != '' && needs.tag.outputs.bump != 'none'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch and checkout the latest commit
run: |
git fetch origin main
git checkout origin/main
- uses: pnpm/action-setup@v2
with:
version: 9
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
extensions: dom, curl, libxml, mbstring, zip
ini-values: error_reporting=E_ALL
tools: composer:v2
coverage: none
- name: Cache composer vendor files
id: cache-composer
uses: actions/cache@v3
env:
cache-name: cache-composer
with:
path: /vendor
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.lock') }}
- name: Install dependencies
uses: nick-fields/retry@v3
with:
timeout_minutes: 1
max_attempts: 5
command: composer install --no-interaction
- name: Use Node.js 22
uses: actions/setup-node@v4
with:
node-version: 22
cache: "pnpm"
- run: pnpm -r install
- name: Build assets
run: pnpm -r run build
- name: Create ZIP for release
run: |
mkdir -p temp_inertia-wordpress
rsync -a --exclude-from=exclude.txt . temp_inertia-wordpress/
mv temp_inertia-wordpress inertia-wordpress
zip -r inertia-wordpress.zip inertia-wordpress
rm -rf inertia-wordpress
- name: Create Github release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.tag.outputs.new_tag }}
name: ${{ needs.tag.outputs.new_tag }}
body_path: changelog/${{ needs.version.outputs.changelog }}.md
draft: false
prerelease: false
files: inertia-wordpress.zip