Skip to content

Release

Release #188

Workflow file for this run

name: Release
on:
schedule:
- cron: "0 8 * * 1" # At 08:00 on Monday.
workflow_dispatch: # Allows manual triggering
jobs:
e2e:
uses: ./.github/workflows/tests.yml
update:
name: Update version
needs: e2e
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
steps:
- name: Check out repository
uses: actions/checkout@v6
with:
fetch-depth: 0 # Fetch all history so we can access tags and commits
fetch-tags: true # Ensure tags are fetched
- name: Install pnpm
uses: pnpm/action-setup@v5
with:
version: 10
- name: Install Node.js LTS
uses: actions/setup-node@v6
with:
node-version: lts/*
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Build assets
run: pnpm build
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "latest"
- name: Install Composer
uses: ramsey/composer-install@v4
- name: Downgrade PHP code to the minimum version WordPress requires
run: vendor/bin/rector --ansi
- name: Validate PHP syntax to prevent fatal errors
run: find . -name "*.php" -type f -not \( -path "./vendor/*" -o -path "./node_modules/*" \) -print0 | xargs -0 -n1 php -l
- name: Install jq
run: sudo apt-get install -y jq
- name: Run release.sh script
id: script
shell: bash
run: |
chmod +x ./release.sh
./release.sh
- name: Commit and push changes
if: steps.script.outputs.has-changed == 'true'
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git add .
git commit -m "${{ steps.script.outputs.release-name }}"
# Push changes, handling potential conflicts
git push || git pull --rebase origin ${{ github.ref_name }} && git push
- name: WordPress Plugin Deploy
if: steps.script.outputs.has-changed == 'true'
id: deploy
uses: 10up/action-wordpress-plugin-deploy@2.3.0
with:
generate-zip: true
env:
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SLUG: simpleanalytics
VERSION: ${{ steps.script.outputs.stable-tag }}
ASSETS_DIR: assets
- name: Name release zip like repository
if: steps.script.outputs.has-changed == 'true'
id: release_zip
run: |
cp "${{ steps.deploy.outputs.zip-path }}" "${{ github.workspace }}/${{ github.event.repository.name }}.zip"
echo "path=${{ github.workspace }}/${{ github.event.repository.name }}.zip" >> "$GITHUB_OUTPUT"
- name: Create GitHub release
if: steps.script.outputs.has-changed == 'true'
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ steps.script.outputs.stable-tag }}
name: ${{ steps.script.outputs.release-name }}
body: ${{ steps.script.outputs.release-body }}
draft: false
prerelease: false
files: ${{ steps.release_zip.outputs.path }}